Skip to content Skip to sidebar Skip to footer

Ibm Mobilefirst : App Gets Restarted When I Click On The Notification

I am developing android native app with MFP Integrated. I have Implemented MFP push notification and it works fine. I get the notification. But when I click the notification my app

Solution 1:

Setting up a GCM client in Android and Receiving downstream messages are great references you'll be looking into for your scenario.

You'll have to define the GCM Receivers and Services that are needed to receive the messages. This will greatly help for you to receive messages in any Activity (since a Service doesn't need any UI, and BroadcastReceiver will help that the CPU is awake so the listener service will complete its task).

Hope this helps!

Solution 2:

Finally i got some solution.

I have created a dummy activity and binding the above mention code to it.`

<activityandroid:name=".controllers.activities.DummyActivity"android:launchMode="singleTask"android:theme="@style/AppTheme.NoActionBar"><intent-filter><actionandroid:name="com.mypackage.NOTIFICATION" /><categoryandroid:name="android.intent.category.DEFAULT" /></intent-filter></activity>

If my app is in background and app gets a notification . On clicking of Notification it will open the dummyactivity and i am calling finish() method in the onResume(). So this particular activity will be finished even before it is opened which will open the pervious activity and I am putting a check saying applaunched if it is false, I am relaunching the app.

This cant be a straight solution but it is a work around for now.

Post a Comment for "Ibm Mobilefirst : App Gets Restarted When I Click On The Notification"