Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send data from BroadcastReceiver to an Activity in android?

Tags:

android

I am writing an application to listen the SMS inbox in Android with one Activity and one BroadcastReceiver.
Once the SMS comes the Receiver is showing Alert message...

But i want to send the message information from Receiver to Activity.
I don't know how to achieve this.
Anybody knows it please help me...

like image 825
Rajapandian Avatar asked Oct 14 '22 07:10

Rajapandian


1 Answers

I am writing an application to listen the SMS inbox in android with one activity and one BroadcastReceiver.

Please do not do this. This is not part of the Android SDK. Your application will break on some phones. Your application may break in future editions of Android.

But i want to send the message information from Receiver to Activity.

Send another broadcast Intent, this one a private one for use within your own application, where the Activity has registered a BroadcastReceiver (via registerReceiver()) for your private Intent.

like image 121
CommonsWare Avatar answered Oct 20 '22 00:10

CommonsWare