What is the best solution for push notifications on Android 13?

I am implementing push notifications on Android 13.

In Android 13, notifications are turned off by default. How can I allow users to choose to receive notifications?

iOS has notification.registerForPushNotifications() but Android does not. Does this mean that in Android 13, if there is google-services.json, the same display will be automatically displayed?

I recently changed my app to a different owner, and since then I’ve noticed that notifications aren’t working properly.
Previously, notification permission was obtained using notifications.scheduleNotification() to support Android 13, but now nothing is displayed either.
I haven’t changed anything to my Firebase settings or account.

I would like to know the optimal solution for implementing notifications for Android 13.

By the way, is there a trend these days that notifications are not very effective for app operation and revenue?

You need to include "android.permission.POST_NOTIFICATIONS" permission in your build.settings. Then you need to request the permission during runtime, e.g. native.showPopup( "requestAppPermission", { appPermission="android.permission.POST_NOTIFICATIONS" } )

Optimal solution is a bit difficult question to answer, but primarily you’d want to hold off on asking a user’s permission until you’re certain they are at least somewhat engaged with your app. Then you want to present the permission request to them in a way that agreeing to receive notifications will benefit them somehow. I for one wouldn’t give an app the permission to send me notifications unless I knew what the notifications would be about and that I would benefit from receiving them.

Well-implemented notifications do improve user retention rates.

thank you for your reply.

I looked at the Solar2D reference and implemented it, but the explanation seems to be insufficient.

I also searched past forums, but couldn’t really find anything Vlad had said in the past.

Per your instructions, permission has been granted successfully. I was able to successfully test notifications as well.
However, it doesn’t affect the behavior of the notification and it doesn’t crash, but I get the following error:

Corona : ERROR: CoronaActivity.DefaultRequestPermissiosnResultHandler.forwardRequestPermissionsResultToLua():Cannot forward results to Lua as no registry ID was found!

Is it okay to not worry about this?

Also, if a user receives a notification, do you know if it’s against the policy to give them some kind of reward that they can use within app?

Sorry about the delay, I got sidetracked and completely forgot to respond.

Seems the documentation for notifications hasn’t been specifically updated to include the part about requesting permissions on Android after Android API 33. The information that I used was from here:

On Android, this can also be the name of anything in the usesPermissions table of build.settings, such as "android.permission.READ_SMS" or "com.android.voicemail.permission.ADD_VOICEMAIL". The full name of an Android permission group such as "android.permission-group.STORAGE" or "android.permission-group.PHONE" is also valid.

I wasn’t aware of including those extra parameters that Vlad mentioned in the post you linked. I’m not sure of any issues with the error message that you’re getting. It could be that this is a previously non-standard request and the existing validation checks don’t account for requesting for permissions in this manner? I haven’t experienced any issues this way.

Google and Apple have been against rewarding players in order to obtain likes or followers on social media sites, but I haven’t heard anything of their rules regarding notifications and what they think of that. Personally, I view notifications as the benefit, so they don’t need anything else. If your game is engaging enough and the users can benefit from using notifications, e.g. the app prompting them of important events, then they already improve the users experience by themselves. If the users aren’t engaged anyway, then I highly doubt notifications could make a difference.

Thank you for your reply.

It was my first time to know that you can do so many things with native.showPopup(). Thank you very much for letting me know.
The error is still output, but it does not affect operation, so I do not care about it. I’m already using the product version, and so far there don’t seem to be any problems.

Also, thank you for your thoughts regarding the effectiveness of notifications. I will use it as a reference as it is very educational.