gpt4 book ai didi

android - 收到消息时,Urban Airship 通知不会显示在 Android 设备中

转载 作者:行者123 更新时间:2023-11-29 15:58:09 24 4
gpt4 key购买 nike

我已经将 Urban Airship 库集成到一个 android 项目中。我的问题是我尝试通过 Urban Airship 仪表板中的测试推送通知发送消息。当我在 logcat -> Received push message: Bundle[{com.urbanairship.push.ALERT=bla blaba 等中看到时,这意味着我收到消息时没有显示通知对话框。我究竟做错了什么?此外,我添加了 Intent 接收器类并尝试添加自定义通知对话框但没有任何效果。在 IntentReceiver 类上,被调用的函数是

protected void onBackgroundPushReceived(Context context, PushMessage message)

但不是

onPushReceived(Context context, PushMessage message, int notificationId)

谢谢。

最佳答案

        //Change your UAirship.takeoff() to this :

//Urban Airship
AirshipConfigOptions options = AirshipConfigOptions.loadDefaultOptions(getApplicationContext());

// Take off initializes the services
UAirship.takeOff(this, options);
UAirship.shared().getPushManager().setUserNotificationsEnabled(true);

//From this

UAirship.takeOff(this, new UAirship.OnReadyCallback() {
@Override public void onAirshipReady(UAirship airship) {
// Perform any airship configurations here
airship.getPushManager().setPushEnabled(true);
});

关于android - 收到消息时,Urban Airship 通知不会显示在 Android 设备中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26674754/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com