Unsure what the specific issue is, but the below code halts before it finishes and does not make it to Log.d("debug", "debug 2.4.3");
.
NotificationCompat.Action actionViewContact, actionCreateActivity;
Class createContact = ViewContactsActivity.class;
Class viewContacts = ViewContactsActivity.class;
Class createActivity= CreateActivityActivity.class;
//Activities to launch via notifications
Intent createContactIntent = new Intent(context, createContact);
Intent viewContactsIntent = new Intent(context, viewContacts);
Intent createActivityIntent = new Intent(context, createActivity);
//Put Extras
createContactIntent.putExtra(ViewContactsActivity.CREATE_CONTACT_KEY, true);
createContactIntent.putExtra(ViewContactsActivity.ANI_KEY, ani);
createContactIntent.putExtra(MainActivity.ONSTART_KEY, MainActivity.ONSTART_CREATE_CONTACT);
viewContactsIntent.putExtra(ViewContactsActivity.CONTACTS_KEY, (ArrayList)contacts);
viewContactsIntent.putExtra(ViewContactsActivity.ANI_KEY, ani);
viewContactsIntent.putExtra(MainActivity.ONSTART_KEY, MainActivity.ONSTART_VIEW_CONTACTS);
createActivityIntent.putExtra(CreateActivityActivity.CONTACT_KEY, contacts.get(0));
createActivityIntent.putExtra(CreateActivityActivity.ANI_KEY, contacts.get(0));
createActivityIntent.putExtra(MainActivity.ONSTART_KEY, MainActivity.ONSTART_CREATE_ACTIVITY);
//Add backstack, so that back button results in returning to MainActivity.class
TaskStackBuilder sbCreateContact = TaskStackBuilder.create(context);
TaskStackBuilder sbViewContacts = TaskStackBuilder.create(context);
TaskStackBuilder sbCreateActivity = TaskStackBuilder.create(context);
sbCreateContact.addParentStack(createContact).addNextIntent(createContactIntent);
sbViewContacts.addParentStack(viewContacts).addNextIntent(viewContactsIntent);
sbCreateActivity.addParentStack(createActivity).addNextIntent(createActivityIntent);
//Create pending intents for notification actions
int piFlag = PendingIntent.FLAG_UPDATE_CURRENT;
Log.d("debug", "debug 2.4.1");
PendingIntent piCreateContact = sbCreateContact.getPendingIntent(0, piFlag);
Log.d("debug", "debug 2.4.2");
PendingIntent piViewContacts = sbViewContacts.getPendingIntent(0, piFlag);
Log.d("debug", "debug 2.4.3");
PendingIntent piCreateActivity= sbCreateActivity.getPendingIntent(0, piFlag);
Log.d("debug", "debug 2.4.4");
I am trying to look deeper into it, but this is certainly an odd bug.
I was able to solve the issue. It resided in the line
viewContactsIntent.putExtra(ViewContactsActivity.CONTACTS_KEY, (ArrayList)contacts);
. If you bundle and object improperly into an intent then try to callgetPendingIntent()
, the program will crash and fail to display a bug report/logs. I crawled through the source code and found several empty catch blocks.The actual solution involved having Contact class implement Parcable properly.