Android Question Problems with android push and permissions

schimanski

Well-Known Member
Licensed User
Longtime User
Did something changed to push-permissions under android? After new installation, the app does not asked any more if push-messages are allowed. In the settings, the permission for messages are set to 'not allowed' and the user have to change it manually in the settings.

I followed the tutorial

https://www.b4x.com/android/forum/t...s-firebase-cloud-messaging-fcm.67716/#content

with adding the new receiver. Than i added the three lines in the manifest:

B4X:
    CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
    CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
    CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)

and i use b4a version 12.20 and set the versions to

<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="31"/>


Overall, however, it is also noticeable that push has lost a lot of its reliability under android, even if the priority is set to 10 in the b4j sending-tool.
 

schimanski

Well-Known Member
Licensed User
Longtime User
Thanks for answer!
Try to uninstall the app and install it again.

I did it several times, but always the same. On the fold 3, the system sets the notification after new installation to not allowed. The fold 3 has Android 13. I set the targetsdk to 31. Could this be the problem? From 10 installations, the fold 3 asked me two times to allow the notification after a few app starts, not all the times.
When the user sets the permission for notification in the settings of the app, the notifies will arrive reliably.
On an Galaxy A53 with android 12, the notifocation is set to allowed and there are no problems.

I also think I found that the receiver is not always started from the beginning after installation. It could be, that the starter-service tried to call the 'Public Sub SubscribeToTopics' in the FirebaseMessaging-Receiver, but does not reach it. So there are more than one app-starts needed to subscribe to topics. But maybe I got it wrong.
 
Upvote 0

schimanski

Well-Known Member
Licensed User
Longtime User
Once it is approved it shouldn't be asked again.
Sorry, then we misunderstood each other. After each complete deinstallation and new installation, the system only asked me twice for permission out of the 10 installations. In principle, this should happen after every new installation that has been uninstalled beforehand.

Now i made some more tests. The Galaxy A53, which worked fine under Android 12 get's an update to Android 13 and after that, there are the same different behaviors as under the galaxy fold 3:
After the fist app start (after installation), the notification is set to not allowed by default. Only when a message arrives, the app asked the user, whether it is allowed or not. So the first message will not show an notification and it is a strange behavior, since the query may not come until days after the installation.
This is the behavior, when the targetdk is set to 31.
I made round about 50 installations and deinstallations and a few times, the app asked for permission only one ore two times at the first start of the app, all the other installations, the permission is asked after the first push arrives.

If i set the targetsdk to 33, the device does not asked if notifications are allowed and under settings there is no entry for notifications. So it is not possible to set it manually. The app also is not able to receive notifications under Android 13 and targetsdk 33.
(All messages will be arrived in Sub fm_MessageArrived (Message As RemoteMessage) in the logs. But not possible to set a notification.)

But as said, only under android 13.
 

Attachments

  • Push.zip
    141.7 KB · Views: 48
Last edited:
Upvote 0
Top