0

My MainACtivity.java calls a service activity (GCM.java) for registering to GCM and sending registration id to server.

I want to retrieve the registration id in my MainActivity to use it. How can this be done?

I tried using Intents but that makes me go back my MainActivity and i dont want that.

Thanks

gn123
  • 1
  • 2
  • you want to send the registrationId obtained in Service back to your activity ? – Haris Aftab Apr 19 '16 at 10:41
  • Please see this http://stackoverflow.com/questions/17909377/how-to-send-data-from-service-to-activity – Haris Aftab Apr 19 '16 at 11:11
  • Thankyou for your response. I will try this as well However I searched and figured out it was easier done by storing it in sharedPreference and retrieving it in MainActivity – gn123 Apr 19 '16 at 18:18
  • actually this is the proper way of communication not the way with shared preference. – Haris Aftab Apr 20 '16 at 04:52

0 Answers0