Requirement on notification clicked: I want to handle(execute) IntentReceiver.java class on click of the notification and then forward intent.
IntentReceiver.java(subclass of BroadcastReceiver) ---> Notification.java(activity) ---> Main dashboard(activity)
1.) In my application, I have a separate class "IntentReceiver.java", which is the subclass of "BroadcastReceiver".
2.) After that, inside my "IntentReceiver.java" class, I switch to the "Notification.java" class which have no layout screen, manipulate some data and switch to the main dashboard.
3.) On this main dashboard, I will handle different dialogue on behalf of the different keys received(via putExtra()) on main dashboard from "Notification .java" class after a manipulation.
Code for IntentReceiver.java class : This is a separate class to handle each of the notification.
public class IntentReceiver extends BroadcastReceiver { Context ctx; private static String PUSH_KEY_ALERT = "alert"; @Override public void onReceive(Context context, Intent intent) { this.ctx = context; String alert = intent.getStringExtra(PUSH_KEY_ALERT); Bundle extras = getResultExtras(true); extras.putInt(PushIOManager.PUSH_STATUS, PushIOManager.PUSH_HANDLED_NOTIFICATION); setResultExtras(extras); } }
Manifest Configuration:
<receiver android:name="com.DxS.android.push.IntentReceiver" > </receiver> <activity android:name=".Notification"> <action android:name="com.DxS.android.NOTIFICATIONPRESSED" /> <category android:name="android.intent.category.DEFAULT" /> </activity> <activity android:name=".dashboard"> </activity>
This is the flow of my requirement, Can you please provide a best way to do that. Thanks in advance...