【问题标题】:How to change Parse Push Notification icon programmatically?如何以编程方式更改解析推送通知图标?
【发布时间】:2015-08-22 15:31:42
【问题描述】:

我使用Parse push notification 向用户发送一些消息。 但我想以编程方式更改每条消息的通知图标。 我该怎么做?

【问题讨论】:

    标签: android parse-platform push-notification android-notifications


    【解决方案1】:

    您可以拦截onPushReceived 并创建自己的通知并设置图标。 最简单的方法应该是传递 PushService.subscribe() 上的图标,调用 PushService.subscribe(context, channel, activity, icon)

    PushService.setDefaultPushCallback(context, SomeActivity.class, R.drawable.customIcon)
    
    PushService.subscribe(context, "ChannelName", SomeActivity.class, R.drawable.customIcon)
    

    如果您只想使用不同的图标,请将其添加到清单中:

    <meta-data android:name="com.parse.push.notification_icon" android:resource="@drawable/push_icon"/>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-20
      • 1970-01-01
      相关资源
      最近更新 更多