Android 如何在默认情况下使用react native firebase启用浮动通知?
Halo,我使用react-native firebase在react-native中提供推送通知,它在emulator上运行良好,但在某些设备上默认禁用浮动通知、锁屏通知和声音Android 如何在默认情况下使用react native firebase启用浮动通知?,android,react-native,android-notifications,react-native-firebase,Android,React Native,Android Notifications,React Native Firebase,Halo,我使用react-native firebase在react-native中提供推送通知,它在emulator上运行良好,但在某些设备上默认禁用浮动通知、锁屏通知和声音 如何通过应用程序安装强制启用这些设置?我没有尝试,但首先您可以使用支持库中的NotificationManagerCompat.arNotificationsEnabled()检查通知是否已禁用。API 19以下的版本将返回true(启用通知) 然后,如果禁用了通知,则可以警告用户并启动通知设置,如: 谢谢,我忘了在
如何通过应用程序安装强制启用这些设置?我没有尝试,但首先您可以使用支持库中的
NotificationManagerCompat.arNotificationsEnabled()
检查通知是否已禁用。API 19以下的版本将返回true(启用通知)
然后,如果禁用了通知,则可以警告用户并启动通知设置,如:
谢谢,我忘了在我的根屏幕上检查权限:D我使用react-native和react-native firebase,以下是文档:
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);