Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid App crashing after receiving push notification
    primarykey
    data
    text
    <p>I am using urban airship to push notification. Unfortunately app is crashing while getting push. </p> <pre><code>public class IntentReceiver extends BroadcastReceiver { private static final String logTag = "PushSample"; @Override public void onReceive(Context context, Intent intent) { Log.i(logTag, "Received intent: " + intent.toString()); String action = intent.getAction(); if (action.equals(PushManager.ACTION_PUSH_RECEIVED)) { int id = intent.getIntExtra(PushManager.EXTRA_NOTIFICATION_ID, 0); logPushExtras(intent); } else if (action.equals(PushManager.ACTION_NOTIFICATION_OPENED)) { logPushExtras(intent); Intent launch = new Intent(Intent.ACTION_MAIN); launch.setClass(UAirship.shared().getApplicationContext(), GetStartedActivity.class); launch.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); UAirship.shared().getApplicationContext().startActivity(launch); } else if (action.equals(PushManager.ACTION_REGISTRATION_FINISHED)) { } else if (action.equals(PushManager.ACTION_GCM_DELETED_MESSAGES)) { } } private void logPushExtras(Intent intent) { Set&lt;String&gt; keys = intent.getExtras().keySet(); for (String key : keys) { //ignore standard C2DM extra keys List&lt;String&gt; ignoredKeys = (List&lt;String&gt;)Arrays.asList( "collapse_key",//c2dm collapse key "from",//c2dm sender PushManager.EXTRA_NOTIFICATION_ID,//int id of generated notification (ACTION_PUSH_RECEIVED only) PushManager.EXTRA_PUSH_ID,//internal UA push id PushManager.EXTRA_ALERT);//ignore alert if (ignoredKeys.contains(key)) { continue; } } } } </code></pre> <p>Push is successively logged but app get crashing.. I am testing on Samsung galaxy tab .</p> <p>This is my class</p> <pre><code>AirshipConfigOptions options = AirshipConfigOptions.loadDefaultOptions(this); // Optionally, customize your config at runtime: // // options.inProduction = false; // options.developmentAppKey = "Your Development App Key"; // options.developmentAppSecret "Your Development App Secret"; UAirship.takeOff(this, options); Logger.logLevel = Log.VERBOSE; //use CustomPushNotificationBuilder to specify a custom layout CustomPushNotificationBuilder nb = new CustomPushNotificationBuilder(); //nb.statusBarIconDrawableId = R.drawable.icon_small;//custom status bar icon //nb.layout = R.layout.notification; //nb.layoutIconDrawableId = R.drawable.icon;//custom layout icon //nb.layoutIconId = R.id.icon; //nb.layoutSubjectId = R.id.subject; //nb.layoutMessageId = R.id.message; // customize the sound played when a push is received //nb.soundUri = Uri.parse("android.resource://"+this.getPackageName()+"/" +R.raw.cat); PushManager.shared().setNotificationBuilder(nb); PushManager.shared().setIntentReceiver(IntentReceiver.class); PushManager.enablePush(); </code></pre> <p>Seems like CustomPushNotificationBuilder is creating issue</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload