How to change “Category” in Oreo onwards notification?












0














Below is the Settings screen of Facebook app. In my app it displays "Category", here it is "Kalis Martinez". I want to achieve that in my app.



enter image description here



What my app is displaying is as below:



enter image description here



What I am doing is as below.



NotificationManager manager = (NotificationManager) 
getSystemService(Context.NOTIFICATION_SERVICE);
manager.createNotificationChannelGroup(new
NotificationChannelGroup(groupId, groupName));

String GROUP_KEY_WORK_EMAIL = "com.android.example.WORK_EMAIL";

Notification notification = new Notification.Builder(getApplicationContext(), SECONDARY_CHANNEL)
.setContentTitle(title)
.setContentText(body)
//build summary info into InboxStyle template
.setStyle(new Notification.InboxStyle()
.addLine("Alex Faarborg Check this out")
.addLine("Jeff Chang Launch Party")
.setBigContentTitle("2 new messages")
.setSummaryText("janedoe@example.com"))
//specify which group this notification belongs to
.setGroup(GROUP_KEY_WORK_EMAIL)
//set this notification as the summary for the group
.setGroupSummary(true)
.setSmallIcon(getSmallIcon())
.setAutoCancel(true);

manager.notify(id, notification.build());


setGroup() and setGroupSummary() do grouping while displaying notifications in System tray.



How to change that label?










share|improve this question





























    0














    Below is the Settings screen of Facebook app. In my app it displays "Category", here it is "Kalis Martinez". I want to achieve that in my app.



    enter image description here



    What my app is displaying is as below:



    enter image description here



    What I am doing is as below.



    NotificationManager manager = (NotificationManager) 
    getSystemService(Context.NOTIFICATION_SERVICE);
    manager.createNotificationChannelGroup(new
    NotificationChannelGroup(groupId, groupName));

    String GROUP_KEY_WORK_EMAIL = "com.android.example.WORK_EMAIL";

    Notification notification = new Notification.Builder(getApplicationContext(), SECONDARY_CHANNEL)
    .setContentTitle(title)
    .setContentText(body)
    //build summary info into InboxStyle template
    .setStyle(new Notification.InboxStyle()
    .addLine("Alex Faarborg Check this out")
    .addLine("Jeff Chang Launch Party")
    .setBigContentTitle("2 new messages")
    .setSummaryText("janedoe@example.com"))
    //specify which group this notification belongs to
    .setGroup(GROUP_KEY_WORK_EMAIL)
    //set this notification as the summary for the group
    .setGroupSummary(true)
    .setSmallIcon(getSmallIcon())
    .setAutoCancel(true);

    manager.notify(id, notification.build());


    setGroup() and setGroupSummary() do grouping while displaying notifications in System tray.



    How to change that label?










    share|improve this question



























      0












      0








      0







      Below is the Settings screen of Facebook app. In my app it displays "Category", here it is "Kalis Martinez". I want to achieve that in my app.



      enter image description here



      What my app is displaying is as below:



      enter image description here



      What I am doing is as below.



      NotificationManager manager = (NotificationManager) 
      getSystemService(Context.NOTIFICATION_SERVICE);
      manager.createNotificationChannelGroup(new
      NotificationChannelGroup(groupId, groupName));

      String GROUP_KEY_WORK_EMAIL = "com.android.example.WORK_EMAIL";

      Notification notification = new Notification.Builder(getApplicationContext(), SECONDARY_CHANNEL)
      .setContentTitle(title)
      .setContentText(body)
      //build summary info into InboxStyle template
      .setStyle(new Notification.InboxStyle()
      .addLine("Alex Faarborg Check this out")
      .addLine("Jeff Chang Launch Party")
      .setBigContentTitle("2 new messages")
      .setSummaryText("janedoe@example.com"))
      //specify which group this notification belongs to
      .setGroup(GROUP_KEY_WORK_EMAIL)
      //set this notification as the summary for the group
      .setGroupSummary(true)
      .setSmallIcon(getSmallIcon())
      .setAutoCancel(true);

      manager.notify(id, notification.build());


      setGroup() and setGroupSummary() do grouping while displaying notifications in System tray.



      How to change that label?










      share|improve this question















      Below is the Settings screen of Facebook app. In my app it displays "Category", here it is "Kalis Martinez". I want to achieve that in my app.



      enter image description here



      What my app is displaying is as below:



      enter image description here



      What I am doing is as below.



      NotificationManager manager = (NotificationManager) 
      getSystemService(Context.NOTIFICATION_SERVICE);
      manager.createNotificationChannelGroup(new
      NotificationChannelGroup(groupId, groupName));

      String GROUP_KEY_WORK_EMAIL = "com.android.example.WORK_EMAIL";

      Notification notification = new Notification.Builder(getApplicationContext(), SECONDARY_CHANNEL)
      .setContentTitle(title)
      .setContentText(body)
      //build summary info into InboxStyle template
      .setStyle(new Notification.InboxStyle()
      .addLine("Alex Faarborg Check this out")
      .addLine("Jeff Chang Launch Party")
      .setBigContentTitle("2 new messages")
      .setSummaryText("janedoe@example.com"))
      //specify which group this notification belongs to
      .setGroup(GROUP_KEY_WORK_EMAIL)
      //set this notification as the summary for the group
      .setGroupSummary(true)
      .setSmallIcon(getSmallIcon())
      .setAutoCancel(true);

      manager.notify(id, notification.build());


      setGroup() and setGroupSummary() do grouping while displaying notifications in System tray.



      How to change that label?







      android push-notification android-8.0-oreo






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 12 '18 at 13:38









      Fantômas

      32.4k156388




      32.4k156388










      asked Nov 12 '18 at 13:01









      pratik03pratik03

      309415




      309415
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Use this for create a notification Group to change title like this



          // The id of the group.
          String groupId = "my_group_01";
          // The user-visible name of the group.
          CharSequence groupName = getString(R.string.group_name);
          NotificationManager mNotificationManager =
          (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
          mNotificationManager.createNotificationChannelGroup(new NotificationChannelGroup(groupId, groupName));


          Or check about Notification Channels






          share|improve this answer





















          • I am doing that just after creating notificationManager instance. But its not working. Is there any change while creating channel too?
            – pratik03
            Nov 12 '18 at 13:19










          • Post your code for better help instructions
            – Sandeep Parish
            Nov 12 '18 at 13:29












          • I have posted that above in the question.
            – pratik03
            Nov 12 '18 at 13:32











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53262736%2fhow-to-change-category-in-oreo-onwards-notification%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Use this for create a notification Group to change title like this



          // The id of the group.
          String groupId = "my_group_01";
          // The user-visible name of the group.
          CharSequence groupName = getString(R.string.group_name);
          NotificationManager mNotificationManager =
          (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
          mNotificationManager.createNotificationChannelGroup(new NotificationChannelGroup(groupId, groupName));


          Or check about Notification Channels






          share|improve this answer





















          • I am doing that just after creating notificationManager instance. But its not working. Is there any change while creating channel too?
            – pratik03
            Nov 12 '18 at 13:19










          • Post your code for better help instructions
            – Sandeep Parish
            Nov 12 '18 at 13:29












          • I have posted that above in the question.
            – pratik03
            Nov 12 '18 at 13:32
















          0














          Use this for create a notification Group to change title like this



          // The id of the group.
          String groupId = "my_group_01";
          // The user-visible name of the group.
          CharSequence groupName = getString(R.string.group_name);
          NotificationManager mNotificationManager =
          (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
          mNotificationManager.createNotificationChannelGroup(new NotificationChannelGroup(groupId, groupName));


          Or check about Notification Channels






          share|improve this answer





















          • I am doing that just after creating notificationManager instance. But its not working. Is there any change while creating channel too?
            – pratik03
            Nov 12 '18 at 13:19










          • Post your code for better help instructions
            – Sandeep Parish
            Nov 12 '18 at 13:29












          • I have posted that above in the question.
            – pratik03
            Nov 12 '18 at 13:32














          0












          0








          0






          Use this for create a notification Group to change title like this



          // The id of the group.
          String groupId = "my_group_01";
          // The user-visible name of the group.
          CharSequence groupName = getString(R.string.group_name);
          NotificationManager mNotificationManager =
          (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
          mNotificationManager.createNotificationChannelGroup(new NotificationChannelGroup(groupId, groupName));


          Or check about Notification Channels






          share|improve this answer












          Use this for create a notification Group to change title like this



          // The id of the group.
          String groupId = "my_group_01";
          // The user-visible name of the group.
          CharSequence groupName = getString(R.string.group_name);
          NotificationManager mNotificationManager =
          (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
          mNotificationManager.createNotificationChannelGroup(new NotificationChannelGroup(groupId, groupName));


          Or check about Notification Channels







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 12 '18 at 13:09









          Sandeep ParishSandeep Parish

          1,0931114




          1,0931114












          • I am doing that just after creating notificationManager instance. But its not working. Is there any change while creating channel too?
            – pratik03
            Nov 12 '18 at 13:19










          • Post your code for better help instructions
            – Sandeep Parish
            Nov 12 '18 at 13:29












          • I have posted that above in the question.
            – pratik03
            Nov 12 '18 at 13:32


















          • I am doing that just after creating notificationManager instance. But its not working. Is there any change while creating channel too?
            – pratik03
            Nov 12 '18 at 13:19










          • Post your code for better help instructions
            – Sandeep Parish
            Nov 12 '18 at 13:29












          • I have posted that above in the question.
            – pratik03
            Nov 12 '18 at 13:32
















          I am doing that just after creating notificationManager instance. But its not working. Is there any change while creating channel too?
          – pratik03
          Nov 12 '18 at 13:19




          I am doing that just after creating notificationManager instance. But its not working. Is there any change while creating channel too?
          – pratik03
          Nov 12 '18 at 13:19












          Post your code for better help instructions
          – Sandeep Parish
          Nov 12 '18 at 13:29






          Post your code for better help instructions
          – Sandeep Parish
          Nov 12 '18 at 13:29














          I have posted that above in the question.
          – pratik03
          Nov 12 '18 at 13:32




          I have posted that above in the question.
          – pratik03
          Nov 12 '18 at 13:32


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53262736%2fhow-to-change-category-in-oreo-onwards-notification%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Full-time equivalent

          さくらももこ

          13 indicted, 8 arrested in Calif. drug cartel investigation