i want when a new message received by onMessage() inside GCMIntentService.java , the onMessage() call a method called blinkLED() inside the MainActivity.java so the blinkLED() method can use the data received by onMessage() , how can i implement that ? a sample code will be helpful.
i want when a new message received by onMessage() inside GCMIntentService.java , the onMessage()
Share
Use BroadcastReceiver. This tutorial shows you how to send a broadcast intent from a class, and have another class handles it.
Short example, in your GCMIntentService::onMessage(), you may have this:
Then in your MainActivity, you implements a BroadcastReceiver :
and register for it in onResume() of MainActivity: