感谢之前的回复。
我正在尝试将城市飞艇集成到我的应用程序中。为此,我在 urbanairship 网站上注册并获得了一些凭据,我还获得了示例程序来测试应用程序。即使应用程序正在运行,但从城市航空网站发送的项目未显示在通知中。不知道如何实现城市飞艇。谁能帮我解决这个问题。
提前致谢
感谢之前的回复。
我正在尝试将城市飞艇集成到我的应用程序中。为此,我在 urbanairship 网站上注册并获得了一些凭据,我还获得了示例程序来测试应用程序。即使应用程序正在运行,但从城市航空网站发送的项目未显示在通知中。不知道如何实现城市飞艇。谁能帮我解决这个问题。
提前致谢
你有没有添加这个代码??
AirshipConfigOptions options = AirshipConfigOptions.loadDefaultOptions(this);
options.developmentAppKey = "Your Development AppKey";
options.developmentAppSecret ="Your development AppSecret";
options.productionAppKey = "Your production app key";
options.inProduction = false; // determines which app key to use
UAirship.takeOff(this, options);
Logger.logLevel = Log.VERBOSE;
// use CustomPushNotificationBuilder to specify a custom layout
CustomPushNotificationBuilder nb = new CustomPushNotificationBuilder();
nb.statusBarIconDrawableId = R.drawable.icon; // custom statusbar icon
nb.layout = R.layout.notification;
nb.layoutIconDrawableId = R.drawable.notifyicon; // custom layout icon
nb.layoutIconId = R.id.icon;
nb.layoutSubjectId = R.id.subject;
nb.layoutMessageId = R.id.message;
PushManager.shared().setNotificationBuilder(nb);
PushManager.shared().setIntentReceiver(IntentReceiver.class);
将以下代码添加到您的清单中并尝试一下,您必须确保添加此代码
<!-- Urban AirShip -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<!-- REQUIRED for C2DM -->
<!--
Only this application can receive the messages and registration result
-->
<!--
MODIFICATION REQUIRED - Replace "com.urbanairship.push.sample" with
your package name
-->
<permission android:name="com.urbanairship.pushdemo.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.urbanairship.pushdemo.permission.C2D_MESSAGE" />
<!-- This app has permission to register and receive message -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- End Urban AirShip -->