【问题标题】:How to activate urban airship如何激活城市飞艇
【发布时间】:2012-03-09 18:39:38
【问题描述】:

感谢之前的回复。

我正在尝试将城市飞艇集成到我的应用程序中。为此,我在 urbanairship 网站上注册并获得了一些凭据,我还获得了示例程序来测试应用程序。即使应用程序正在运行,但从城市航空网站发送的项目未显示在通知中。不知道如何实现城市飞艇。谁能帮我解决这个问题。

提前致谢

【问题讨论】:

  • 嗨,你能告诉我你到目前为止在你的代码中实现了什么
  • 其实我是城市飞艇的新手。我从飞艇网站获得了样本,并整合了我自己的凭据。
  • 这里是关于如何实现这一点的分步教程life-optimized.blogspot.com/2012/03/…>
  • HARIRAM@ 你完成了这个功能吗?我对同样的情况感到不安。首先,我对productionaapkey和secret感到困惑。为什么在示例应用程序中需要它。我需要放在这里。根本没有收到测试通知。 Urban Airship 完全是糟糕的文档。

标签: android urbanairship.com


【解决方案1】:

您是否添加了此代码??

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

【讨论】:

  • 是的,但我尽力提供生产应用程序密钥。我在哪里可以找到完美的例子。
  • 它不需要,我也没有在我的代码中添加它,您是否在清单文件中正确添加了代码?
  • 这是来自城市飞艇的样本,不需要在manifest文件中添加任何内容。我们应该在这个文件中添加什么新内容..??
  • 你有这方面的样品吗??
  • 你在urbanairship网站上正确添加了包裹名称吗??
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多