Notifications don't work on Android
Closed this issue · 5 comments
I've got everything working on iOS but I struggled to get it working on Android. I tried everything and in the end I decided to test your sample application. Notifications are received (validated with breakpoint) but notifications are never shown. Exactly the issue I had with my own app. Every time I receive a notification I find these lines in the log:
[Notification] Use of stream types is deprecated for operations other than volume control
[Notification] See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
Did I forget something? Or is it related to Android Oreo?
@jantanis : Did you test on Android 6?
I have got it working on iOS, on android 6 but on android 8.1.0 I see the breakpoint in the line
CrossAzurePushNotification.Current.OnNotificationReceived += (s, p) =>
but I don't see any notification.
I am also seeing the same messages in my output
I added the lines for Oreo as descibed in the documentation:
//Set the default notification channel for your app when running Android Oreo
if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.O)
{
//Change for your default notification channel id here
AzurePushNotificationManager.DefaultNotificationChannelId = "DefaultChannel";
//Change for your default notification channel name here
AzurePushNotificationManager.DefaultNotificationChannelName = "General";
}
So I am wondering if you have it working on Android 6 like I do.
@jantanis I am thinking doing the same. Is it easier to implement then this plugin?
I love this plugin but not being able to send notification to the latest Android versions makes it unusable for my project.
On a personal note, are you Jan Tanis from Holland that implemented the prognose module from R&R?
@michelmoorlag , @jantanis It is working for me on Anddroid 8.0.0.
You just need to remove:
if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.O) { AzurePushNotificationManager.DefaultNotificationChannelId = "DefaultChannel"; AzurePushNotificationManager.DefaultNotificationChannelName = "General"; }
Seems like, it is not needed to specify channelId and Name