【问题标题】:How to get push notification with urban airship?如何通过城市飞艇获得推送通知?
【发布时间】:2014-01-24 13:55:08
【问题描述】:

我正在尝试使用 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();

}

}

【问题讨论】:

    标签: android push-notification google-cloud-messaging urbanairship.com


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多