Express Guide: How to Get Firebase Push User ID in Android WebView Apps

Way to work. Man texting on phone, standing with bike

Firebase Cloud Messaging (FCM) is a popular service used to send push notifications to Android devices. It can help you keep your users informed about important events and updates. Here are the steps to get Firebase Push User ID in Android WebView apps using the Firebase Cloud Messaging API:

1   Add the Firebase SDK to your Android project.
2   Register your app with Firebase.
3   Once your app is registered with Firebase, you can get the Firebase Push User ID by calling the FirebaseInstanceId.getInstance().getToken() method.
4   Send the Firebase Push User ID to your server using a POST request.

Alternatively, if you are using WebViewGold for Android, you can get the Firebase Push User ID by default. If your WebView URL is https://www.example.org, WebViewGold for Android will call https://www.example.org?firebase_push_id=XYZ instead. You can save the Firebase Push User ID in a session or cookie to access it on your linked pages.
You can also retrieve and process the information on any page via JavaScript by calling a custom protocol and triggering a callback in your native code. Your native code can then retrieve the Firebase Push User ID and send it back to the WebView using JavaScript (by just calling one line of code; getfirebaseplayerid://).