android - 在我的 Android 应用程序中默认启用所有通知设置

标签 android google-play react-native

有什么方法可以在安装我的应用程序时默认启用所有通知设置?

用户正在接收通知,但默认情况下声音是禁用的,我们需要在设备上手动启用它。并非所有用户都可以手动执行此操作。很高兴知道在安装我们的应用程序时是否有任何方法可以检查所有这些内容,例如 WhatsApp 或 Telegram(它们默认检查所有内容)

enter image description here

最佳答案

尝试在 AndroidManifest 文件中使用以下权限

<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY"/>

并为 Oreo 及以上版本设置通知优先级 IMPORTANCE_HIGH Oreo 及以上版本,PRIORITY_HIGH 或 PRIORITY_MAX Oreo 以下版本

Reference link for priority note

Oreo以下版本优先

mBuilder.setSmallIcon(R.drawable.app_logo)
            .setAutoCancel(true)
            .setContentIntent(resultPendingIntent)
            .setContentTitle(title)
            .setStyle(bigPictureStyle)
            .setSound(soundUri)
            .setPriority(NotificationCompat.PRIORITY_HIGH) // prirority here for version below Oreo
            .setWhen(System.currentTimeMillis())
            .setLargeIcon(BitmapFactory.decodeResource(mCtx.getResources(), R.drawable.app_logo))
            .setContentText(message)
            .build();

奥利奥及以上优先

Refer this link

关于android - 在我的 Android 应用程序中默认启用所有通知设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54490143/

相关文章:

android - 为什么 Android Studio 不再构建发布 APK?

安卓 : Network operations in Appwidget

java - 我该如何更换这个?

android - 未找到 Bêta 测试应用

javascript - 如何修复 "Can' t 对未安装的组件执行 React 状态更新。React Native 中的错误

react-native - 键不存在时的 AsyncStorage.getItem 行为

javascript - 如何创建内容 slider 的箭头(React-Native)?

android - 在开始 Activity 之前加载 Activity 成员

android - 倒计时器跳过几毫秒

android - App图片的局限性