简体   繁体   English

当应用程序关闭时,pushwoosh自定义推送广播接收器不会触发

[英]pushwoosh Custom Push Broadcast Receiver not fire when application is close

I have created Custom Push Broadcast Receiver for handle push notification and save notification in local database,but in my app custom receiver not fire when new notification arrive and app is close. 我已经创建了用于处理推送通知的自定义推送广播接收器,并将通知保存在本地数据库中,但是在我的应用程序中,当新通知到达并且应用程序关闭时,自定义接收器不会触发。

I want to save notification in database when app is close and notification arrives. 我想在应用程序关闭且通知到达时将通知保存在数据库中。

Please suggest and help me. 请提出建议并帮助我。

you have to write broadcastreceiver like this and register it manifest so whenever the notification will arrives this receiver will take action. 您必须编写这样的broadcastreceiver并注册它的清单,以便每当通知到达时,此接收器都会采取措施。

 public class PushWooshManager extends BroadcastReceiver {
    public void onReceive(Context context, Intent intent) {
        Log.i("PUSH", "received");
        if (intent!=null){
        write your code to store the notification data

    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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