[英]How to get push interactive notification with Urban Airship in Android?
[英]How to get push notification with urban airship?
我正在嘗試用Urban Airship開發推送通知。 我成功運行了該應用,但我的設備未在我的帳戶中注冊。 我也在logcate中得到這些錯誤。
01-24 19:20:47.480: W/GCMNotification - UALib(30560): Activity com.example.gcmnotification.MainActivity@416c6fb8 was not manually added during onStart(). Call UAirship.shared().getAnalytics().activityStarted in every activity's onStart() method.
01-24 19:21:14.400: E/GCMNotification - UALib(31088): AndroidManifest.xml missing required service: com.urbanairship.analytics.EventService
01-24 19:21:14.410: E/GCMNotification - UALib(31088): AndroidManifest.xml's com.urbanairship.push.GCMPushReceiver declaration missing required com.google.android.c2dm.intent.RECEIVE filter with category=com.example.gcmnotification
01-24 19:21:14.410: E/GCMNotification - UALib(31088): AndroidManifest.xml's com.urbanairship.push.GCMPushReceiver declaration missing required com.google.android.c2dm.intent.REGISTRATION filter with category=com.example.gcmnotification
代碼在這里。
public class MyApplication extends Application{
@Override
public void onCreate() {
AirshipConfigOptions options = AirshipConfigOptions.loadDefaultOptions(this);
options.developmentAppKey = "pahvQlDxxx";
options.developmentAppSecret = "bOltfxxx";
options.productionAppKey = "AIzaSyCS_QxF-AtTglLf5BWxxx";
options.inProduction = false;
//options.iapEnabled = false;
UAirship.takeOff(this, options);
PushManager.enablePush();
}
}
LogCat會告訴您AndroidManifest.xml中缺少的內容。
您的廣播接收器應聲明如下:
<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" />
<category android:name="com.example.gcmnotification" />
</intent-filter>
</receiver>
你應該聲明com.urbanairship.analytics.EventService
:
<service android:name="com.urbanairship.analytics.EventService" />
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.