[英]Push notification does not happening when app is not running - android
我正在使用Urban Airship进行推送通知。 它的工作原理很吸引人,但发现它没有在应用程序未运行时发送推送通知。
如何处理呢? 我确信这是一个常见的情况,并且将会有解决方案。
我检查了堆栈溢出中的许多帖子,但其中大多数是针对iOS的。 我想要Android
AirshipConfigOptions options = AirshipConfigOptions.loadDefaultOptions(this);
UAirship.takeOff(this, options);
Logger.logLevel = Log.VERBOSE;
PushManager.shared().setIntentReceiver(IntentReceiver.class);
PushManager.enablePush();
我在清单Fie中有以下代码
<!-- REQUIRED for Urban Airship GCM-->
<receiver android:name="com.urbanairship.CoreReceiver" />
<receiver android:name="com.urbanairship.push.GCMPushReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<!-- MODIFICATION REQUIRED - Use your package name as the category -->
<category android:name="com.itest.guide.urbanairship" />
</intent-filter>
</receiver>
<service android:name="com.urbanairship.push.PushService" android:label="Push Notification Service"/>
<service android:name="com.urbanairship.push.PushWorkerService" android:label="Push Notification Worker Service"/>
<service android:name="com.urbanairship.analytics.EventService" android:label="Event Service"/>
<!-- This is required for persisting preferences related to push and location -->
<provider android:name="com.urbanairship.UrbanAirshipProvider"
android:authorities="com.itest.mauritiustourguide.urbanairship.provider"
android:exported="false"
android:multiprocess="true" />
<!-- END OF REQUIRED ITEMS -->
<!-- OPTIONAL, if you want to receive push, push opened and registration completed intents -->
<!-- Replace the receiver below with your package and class name -->
<receiver android:name="com.itest.guide.urbanairship.IntentReceiver" />
原因可能是由于清单文件中的广播接收器。 确定要放吗? 广播接收器唤醒应用程序,并在有推送时通知。
它看起来不像BroadcastReceiver意图过滤器中的类别与您的应用程序包匹配的行
<category android:name="com.itest.guide.urbanairship" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.