简体   繁体   中英

Receive push notification from Pushwoosh on Android when app in background

I am using last Pushwoosh SDK on android to receive notifications. in activity I have: PushFragment.init(this); and activity implements PushEventListener Everything works fine when app is in foreground. But when it is in background it receives notification and when I click on it app is opened, but I need to read some data from it. I try it with the way as it is done in Pushwoosh "Native Android SDK" implementation and it works, but in "Android SDK Fragments" as they have it described in their docs broadcast for receivinf notifications in background is not called.

You need to handle push in onNewIntent function as well. That what happens when you tap on the notification and your app starts. Ex:

@Override
public void onNewIntent(Intent intent)
{
    super.onNewIntent(intent);

    //Check if we've got new intent with a push notification
    PushFragment.onNewIntent(this, intent);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM