如何根据 Android 中的 Urban Airship Pushnotification 的额外值更改状态栏图标

发布于 2024-12-29 23:05:11 字数 170 浏览 4 评论 0原文

我正在使用 Urban Airship PushNotification 开发一个应用程序。它对我有用,我也能够收到推送通知。我的要求是通过 Pushnotification 我传递一个额外值,我想根据额外值更改通知的状态栏图标。假设如果额外值是“1”,我想显示我的应用程序图标,如果它是“ 2' 我想显示另一个图标。请帮忙。

I am developing an app with Urban Airship PushNotification. It is working for me, I am able to get the push notification also. My requirement is with Pushnotification I am passing an Extra Value, I want to change the status bar icon for the notification based on the Extra Value.Assume If the Extra Value is '1' I want to show my App Icon, if it is '2' I want to show another icon. Please Help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时光礼记 2025-01-05 23:05:11

我建议禁用 Urban Airship 的通知并手动处理推送事件。

要禁用 Urban Airship 的通知,请覆盖 BasicPushNotificationBuilder

BasicPushNotificationBuilder nb = new BasicPushNotificationBuilder() {
    @Override
    public Notification buildNotification(String alert,
            Map<String, String> extras) {
        return null;
    }
};
// Disable notifications
PushManager.shared().setNotificationBuilder(nb);

然后实现意图接收器 根据此处的文档,并创建您自己的通知以满足您的规范。

I would suggest disabling Urban Airship's notifications and handling the Push events manually.

To disable Urban Airship's notifications, override BasicPushNotificationBuilder:

BasicPushNotificationBuilder nb = new BasicPushNotificationBuilder() {
    @Override
    public Notification buildNotification(String alert,
            Map<String, String> extras) {
        return null;
    }
};
// Disable notifications
PushManager.shared().setNotificationBuilder(nb);

Then implement an intent receiver according to the documentation here, and create your own Notification to meet your spec.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文