在你的 AndroidManifest-
<receiver android:name="com.urbanairship.CoreReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.ACTION_SHUTDOWN" />
</intent-filter>
</receiver>
<receiver android:name="com.urbanairship.push.c2dm.C2DMPushReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.your.app.here" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.your.app.here" />
</intent-filter>
</receiver>
<service android:name="com.urbanairship.push.PushService" />
务必 -
import com.urbanairship.AirshipConfigOptions;
import com.urbanairship.UAirship;
import com.urbanairship.push.PushManager;
在您的活动或课程文件中 -
AirshipConfigOptions options = AirshipConfigOptions.loadDefaultOptions(this);
options.developmentAppKey = "YOURAPPKEY";
options.developmentAppSecret = "YOURAPPSECRET";
options.productionAppKey = "";
options.iapEnabled = false;
options.inProduction = false; //determines which app key to use
UAirship.takeOff(this.getApplication(), options);
PushManager.enablePush();
希望这可以帮助 :)