0

Halo, I have push notification in react-native using react-native-firebase, it's running well on emulator but on some devices the floating notification, lockscreen notification and sound disabled by default.

default setting

how to force enable those setting with app installation?

1 Answer 1

1

I didnt try but first you can check if notifications are disabled by using NotificationManagerCompat.areNotificationsEnabled(), from support library. The versions below API 19 will return true (notifications are enabled).

Then if notifications disabled, you can warn your user and start notification settings like this answer:

Intent intent = new Intent(); intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS"); //for Android 5-7 intent.putExtra("app_package", getPackageName()); intent.putExtra("app_uid", getApplicationInfo().uid); // for Android 8 and above intent.putExtra("android.provider.extra.APP_PACKAGE", getPackageName()); startActivity(intent); 
Sign up to request clarification or add additional context in comments.

1 Comment

Thankyou, I forget to check the permission on my rootscreen :D I use react-native with react-native-firebase, here is the docs: rnfirebase.io/docs/v5.x.x/notifications/receiving-notifications

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.