question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android notification channel

See original GitHub issue

Hi,

thank you for this great plugin and accepting the PR.

I’m still testing with the channel. When I change the description of the channel name, the settings are set back to default. The NotificationManager can retrieve the channel if it exists with GetNotificationChannel(string channelId).

I checked the android docs:

CharSequence name = getString(R.string.channel_name);
String description = getString(R.string.channel_description);
int importance = NotificationManager.IMPORTANCE_DEFAULT;
NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, importance);
channel.setDescription(description);
// Register the channel with the system; you can't change the importance
// or other notification behaviors after this
NotificationManager notificationManager = getSystemService(NotificationManager.class);
notificationManager.createNotificationChannel(channel);

Priority can’t bet set for each NotificationRequest, it is only working for the first. I don’t know what is better: Extend INotificationService with and AndroidCreateChannel Method and remove Priority and ChannelDescription from AndroidOptions, or creating the channel with the first NotificationRequest. With second option, the comment should be extended.

I’m wondering why the channel is recreate, when I change the channel description.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
thudugalacommented, May 27, 2019

@Freddyvdh now Multiple Notification Channels can be created once when app start.

public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
    protected override void OnCreate(Bundle savedInstanceState)
    {
        ....
        // Must create a Notification Channel when API >= 26
        // Can created multiple Notification Channels with different names.
        NotificationCenter.CreateNotificationChannel();
        ....
        LoadApplication(new App());    
        ....    
        NotificationCenter.NotifyNotificationTapped(Intent);
    }
}

try LocalNotification.Sample.sln in Sample/Direct folder

1reaction
thudugalacommented, May 27, 2019

@Freddyvdh Creating an existing notification channel with its original values performs no operation, so it’s safe to call this code when starting an app.

https://developer.android.com/training/notify-user/channels#CreateChannel

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create and manage notification channels
Starting in Android 8.0 (API level 26), all notifications must be assigned to a channel. For each channel, you can set the visual...
Read more >
What Are Android Notification Channels?
"Notification Channels" were introduced in 2017 with Android 8.0 Oreo. The idea is that apps can group different types of notifications into " ......
Read more >
what is notification channel id?notifications not work in api 27
Starting in Android 8.0 (API level 26), all notifications must be assigned to a channel. For each channel, you can set the visual...
Read more >
Exploring Android O: Notification Channels | by Joe Birch
We can create a notification channel group by using the createNotificationChannelGroup() method provided by the Notification Manager. When doing ...
Read more >
Android: Notification Channel Categories
In your OneSignal Dashboard, go to Settings > Messaging > Android Notification Channels · Enter the category name, description, and any defaults the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found