0

我正在使用 Urban Airship 进行推送通知。它的工作原理就像一个魅力,但只是发现它在应用程序未运行时没有发送推送通知。

如何处理?我确信这是一个常见的场景,并且会有一个解决方案。

我检查了堆栈溢出中的许多帖子,但其中大多数是针对 iOS 的。我要安卓

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" />
4

2 回答 2

0

It doesn't look like the line the category in the BroadcastReceiver intent filter matches your app package

<category android:name="com.itest.guide.urbanairship" />
于 2012-11-18T06:29:05.400 回答
0

原因可能是清单文件中的广播接收器。你确定你放了?广播接收器唤醒应用程序,并在有推送时通知。

于 2012-11-18T04:56:17.170 回答