哈洛,我有推通知在反应-本机使用反应-本机-火基,它运行良好的模拟器,但在一些设备浮动通知,锁定通知和声音默认禁用。

如何强制启用那些设置与应用程序安装?
发布于 2019-05-02 10:12:27
我没有尝试,但首先您可以从支持库中使用NotificationManagerCompat.areNotificationsEnabled()检查是否禁用了通知。API 19下面的版本将返回true (已启用通知)。
如果通知已禁用,则可以警告用户并启动通知设置(如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);https://stackoverflow.com/questions/55949768
复制相似问题