0

I need to get device registration id and send it as a parameter in url to webview. I tried many blocks of code but i have no experience in android so it all seems to me as complicated and finaly have no result. all of my needs to get device id in variable and send it as a parameter in url to webview. please help me!! appreciate any help

I have tried this code:

gcm = GoogleCloudMessaging.getInstance(getApplicationContext());
regId = gcm.register(GCM_Config.SENDER_ID);
url="http://www.example.com/" + regId;
webView.loadUrl(url);
Justin
  • 19
  • 3
  • 2
    Please provide the code of what you have tried. This is the traditional guide: (GCM) https://developers.google.com/cloud-messaging/android/client however now Google is encouraging to use FCM https://firebase.google.com/docs/cloud-messaging/ – fernandospr Aug 10 '16 at 13:20
  • Check this [SO question](http://stackoverflow.com/questions/14892657/how-to-reload-android-webview-after-registration-to-gcm-push-notification) if it can help you. – KENdi Aug 11 '16 at 08:22
  • thank you KENdi for your answer as it is much closer to my question but realy i cant extract the answer to my question as i need to register the device in GCM and send the registration id as a parameter to webview throught the url. i hope this clearify my question. – Justin Aug 11 '16 at 11:25
  • Looks like you can use a javascript interface: http://stackoverflow.com/questions/11752052/passing-data-from-java-class-to-web-view-html – Arthur Thompson Aug 11 '16 at 17:30
  • Thank you Arthur Thompson for your answer but i need to know how to make the registration proccess before loading the url in webview and extract the registration id to pass it (i know how to pass the id in url) – Justin Aug 14 '16 at 10:19

0 Answers0