Is there any way I can enable all notification settings by default when my app gets installed ?
Users are receiving notifications but sound is disabled by default and we need to manually enable it on the device. Not all users can do this manually. It would be great to know if there is any way we can check all these things when our app gets installed like WhatsApp or Telegram (they have everything checked by default)
3
Answers
Android 8 or higher you need to use NotificationChannel to enable sound, vibration, sound etc.
but in Redmi note 5 pro (MIUI 10.2.1.0) still notification sound is disabled. I think there is a bug in MIUI. Run this same code in mi A1(Android one mobile) everything fine. It works.
refer this link to know more about Notification Channel
Try using with this below permission in AndroidManifest file
and set notification priority for both below and above Oreo versions
IMPORTANCE_HIGH
for Oreo and above, andPRIORITY_HIGH or PRIORITY_MAX
for below Oreo versionsReference link for priority note
Priority for version below Oreo
Priority for Oreo and above
Refer this link
WhatsApp, Telegram, Snapchat, and so on. These are all white-listed apps which means the package names are hardcoded at OS level to allow some of the permissions enabled by default. Our apps are not so. Hence, we need the user to enable those permissions manually.
You can check this by yourself. Create a new android application give the package name of the Telegram application(org.telegram.messenger) and just run it. Don’t do any code at all, and no need to open the app too. Simply go to the notification settings of the newly created application, where you find all the permissions enabled by default.
Hope you got the answer.