简体   繁体   中英

Group notification from another app with android 7.0

I want group notifications of app that my device installed from another app. Can I do it? My device is android 7.0 Ex: Facebook showed 3 notifications but they don't grouped. So can I group them from my app that don't create new notification

I think , You can only read another app Notifications. Can't modify it. But you can delete it.

Only system privileged app or the app which posted the notification has the permission to modify it.

But from api 24,There is a method to override the group key,

  sbn.setOverrideGroupKey("key");

You can implement Notification Listener Service and try overriding.

And if you want to do it for your own app, use setGroup()

NotificationCompat.Builder builderOne = new NotificationCompat.Builder(context)
    // Other properties
    .setGroupSummary(true)
    .setGroup(KEY_NOTIFICATION_GROUP);

NotificationCompat.Builder builderTwo = new NotificationCompat.Builder(context)
    // Other properties
    .setGroupSummary(true)
    .setGroup(KEY_NOTIFICATION_GROUP);

NotificationCompat.Builder builderThree = new NotificationCompat.Builder(context)
    // Other properties
    .setGroupSummary(true)
    .setGroup(KEY_NOTIFICATION_GROUP);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM