我是城市飛艇的新手,並將其集成到我的Android應用程序中。從飛艇獲得了樣品來源,我遵循相同的程序,以便將飛艇引入我的應用程序。但每當我發送推送通知,我不能通過我的設備。包的名字,我給我的來源同樣我給了飛艇。任何人都可以引導我如何在Android應用程序中集成Urban Airship。城市飛艇推送通知不推送數據
AirshipConfigOptions options = AirshipConfigOptions.loadDefaultOptions(this);
// Optionally, customize your config at runtime:
//
// options.inProduction = false;
options.developmentAppKey = "My Key";
options.developmentAppSecret "My key";
UAirship.takeOff(this, options);
Logger.logLevel = Log.VERBOSE;
//use CustomPushNotificationBuilder to specify a custom layout
CustomPushNotificationBuilder nb = new CustomPushNotificationBuilder();
nb.statusBarIconDrawableId = R.drawable.icon_small;//custom status bar icon
nb.layout = R.layout.notification;
nb.layoutIconDrawableId = R.drawable.icon;//custom layout icon
nb.layoutIconId = R.id.icon;
nb.layoutSubjectId = R.id.subject;
nb.layoutMessageId = R.id.message;
// customize the sound played when a push is received
//nb.soundUri = Uri.parse("android.resource://"+this.getPackageName()+"/" +R.raw.cat);
PushManager.shared().setNotificationBuilder(nb);
PushManager.shared().setIntentReceiver(IntentReceiver.class);
}
而我編譯上面的代碼我得到
e 03-19 16:13:35.455: ERROR/AndroidRuntime(1247): Uncaught handler: thread main exiting due to uncaught exception
03-19 16:13:35.545: ERROR/AndroidRuntime(1247): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.XYZ}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
03-19 16:13:35.545: ERROR/AndroidRuntime(1247): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268)
03-19 16:13:35.545: ERROR/AndroidRuntime(1247): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
03-19 16:13:35.545: ERROR/AndroidRuntime(1247): at android.app.ActivityThread.access$1800(ActivityThread.java:112)
03-19 16:13:35.545: ERROR/AndroidRuntime(1247): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
03-19 16:13:35.545: ERROR/AndroidRuntime(1247): at android.os.Handler.dispatchMessage(Handler.java:99)
03-19 16:13:35.545: ERROR/AndroidRuntime(1247): at android.os.Looper.loop(Looper.java:123)
03-19 16:13:35.545: ERROR/AndroidRuntime(1247): at android.app.ActivityThread.main(ActivityThread.java:3948)
03-19 16:13:35.545: ERROR/AndroidRuntime(1247): at java.lang.reflect.Method.invokeNative(Native Method)
03-19 16:13:35.545: ERROR/AndroidRuntime(1247): at java.lang.reflect.Method.invoke(Method.java:521)
03-19 16:13:35.545: ERROR/AndroidRuntime(1247): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
03-19 16:13:35.545: ERROR/AndroidRuntime(1247): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
03-19 16:13:35.545: ERROR/AndroidRuntime(1247): at dalvik.system.NativeStart.main(Native Method)
03-19 16:13:35.545: ERROR/AndroidRuntime(1247): Caused by: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
03-19 16:13:35.545: ERROR/AndroidRuntime(1247): at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:281)
03-19 16:13:35.545: ERROR/AndroidRuntime(1247): at com.XYZ.onCreate(ManualUpdate.java:86)
03-19 16:13:35.545: ERROR/AndroidRuntime(1247): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
03-19 16:13:35.545: ERROR/AndroidRuntime(1247): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
你能顯示一些代碼嗎?你能看到任何註冊日誌信息嗎?我在我的最新應用中使用它,它工作正常。 – goodm 2012-03-19 09:42:35
我dint看到任何註冊日誌信息..你可以請給我一個指導..我試圖超過2天。我無法得到適當的解決方案。 – RAAAAM 2012-03-19 09:46:42