Be informed we are using heads up notification in our android app up to alert our users. Code is working fine as long as we manually go to settings and enable floating notification in our Xiaomi Redmi 9a Device. Otherwise, it works just like regular notification with just icon on top of status bar waiting for us to pull it down to see the message
Based on some threads, we tried using this line to switch on floating notification by default
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />
But ,end result is same. But seriously speaking, how can we expect a user to go down so deep in settings and enable it. I mean its ridiculous. Is there any way we can get around this issue ?
Declare the permission in the app manifest
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
Check the Permission
ContexCompat.checkSelfPermission(this,Manifest.permission.POST_NOTIFICATION)==PackageManager.PERMISSION_GRANTED { sendNotification(this) }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.