我正在使用Urban Airship进行推送通知。它的功能就像一个魅力,但发现当应用程序没有运行时它没有发送推送通知。
如何处理?我确信这是一个常见的场景,并且会有一个解决方案。
我在堆栈溢出中检查了很多帖子,但大多数都是针对iOS的。我想要Android
AirshipConfigOptions options = AirshipConfigOptions.loadDefaultOptions(this);
UAirship.takeOff(this, options);
Logger.logLevel = Log.VERBOSE;
PushManager.shared().setIntentReceiver(IntentReceiver.class);
PushManager.enablePush();
我在Manifest 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" />
答案 0 :(得分:0)
原因可能是因为清单文件中的广播接收器。你确定放了吗?广播接收器唤醒应用程序,并在有推送时通知。
答案 1 :(得分:0)
它看起来不像BroadcastReceiver意图过滤器中的类别与您的应用包
匹配<category android:name="com.itest.guide.urbanairship" />