0

The new code for notification channel is working fine in older and latest device of oreo but when I tested in API 28(android P) device it didn't show the notification in notification bar, this is the line I've used for start the foreground notification.

startForeground(NOTIFICATION_ID, notification);
Nikunj
  • 3,937
  • 19
  • 33
Nicky
  • 885
  • 9
  • 21

1 Answers1

2

If you target Android 9.0 (API level 28)

Note: Apps that target Android 9.0 (API level 28) or higher and use foreground services must request the FOREGROUND_SERVICE permission. This is a normal permission, so the system automatically grants it to the requesting app.

In Manifest add permission

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
Nikunj
  • 3,937
  • 19
  • 33