when click on notification urban airship starts launcher activity (loginactivity) always, should starts aboutactivity.
<activity android:name=".activity.loginactivity" android:theme="@android:style/theme.black.notitlebar" android:screenorientation="portrait" android:windowsoftinputmode="statevisible"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name=".activity.aboutactivity" android:theme="@android:style/theme.black.notitlebar" android:screenorientation="portrait"/> intentreceiver class:
public class intentreceiver extends baseintentreceiver { private static final string tag = "intentreceiver"; @override protected void onchannelregistrationsucceeded(context context, string channelid) { log.e(tag, "channel registration updated. channel id:" + channelid + "."); } @override protected void onchannelregistrationfailed(context context) { log.e(tag, "channel registration failed."); } @override protected void onpushreceived(context context, pushmessage message, int notificationid) { } @override protected void onbackgroundpushreceived(context context, pushmessage message) { log.e(tag, "received background push message: " + message); } @override protected boolean onnotificationopened(context context, pushmessage message, int notificationid) { bundle bundle = message.getpushbundle(); if(bundle.containskey("eeid") && bundle.containskey("date") && bundle.containskey("job")){ intent intent = new intent(context, aboutactivity.class); intent.putextra(consts.extra_employee_id, bundle.getstring("eeid")); intent.putextra(consts.extra_date, bundle.getstring("date")); intent.putextra(consts.extra_job_id, bundle.getstring("job")); intent.setflags(intent.flag_activity_clear_top | intent.flag_activity_new_task); pendingintent.getactivity(context, 0, intent, 0); } // return false let ua handle launching launch activity return false; } what problem? in advance.
the lines:
// return false let ua handle launching launch activity return false; if return true, notifies urban airship sdk push handled , not auto launch launcher activity.
also, think wanting following:
@override protected boolean onnotificationopened(context context, pushmessage message, int notificationid) { bundle bundle = message.getpushbundle(); if(bundle.containskey("eeid") && bundle.containskey("date") && bundle.containskey("job")){ intent intent = new intent(context, aboutactivity.class); intent.putextra(consts.extra_employee_id, bundle.getstring("eeid")); intent.putextra(consts.extra_date, bundle.getstring("date")); intent.putextra(consts.extra_job_id, bundle.getstring("job")); intent.setflags(intent.flag_activity_clear_top | intent.flag_activity_new_task); context.startactivity(intent); // return true urban airship not auto start activity return true; } else { return false; } }
Comments
Post a Comment