senzacionale
senzacionale

Reputation: 20916

getApplication in BroadcastReceiver in android

I want to use app = (MyApplication)getApplication(); in BroadcastReceiver

i am using thi link: http://www.devahead.com/blog/tag/application/

but getApplication not exits in BroadcastReceiver, How can i use it?

I need it becouse i want to share data between two BroadcastReceiver

Upvotes: 9

Views: 7675

Answers (1)

mah
mah

Reputation: 39807

Your BroadcastReceiver has an onReceive(Context ctx, Intent intent) method which is called to receive a message... you're being hand-delivered a context.

Upvotes: 2

Related Questions