I want to to know how to extras intent value in broadcast receiver onReceive method...
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
String action = intent.getAction();
开发者_如何学Python if(action.equals("android.intent.action.PACKAGE_ADDED")){
Logger.debug("action: Package added");
Bundle b = intent.getExtras();
}
}
now I don't know different key value for this particular intent so please anybody help me how to find key value of intent in onReceive method...
The Intent
documentation (which contains the broadcast action descriptions) explains what extras you can expect in the OS broadcast Intents.
http://developer.android.com/reference/android/content/Intent.html#ACTION_PACKAGE_ADDED
In any case, you can always call keySet()
on the extras Bundle
and see what keys are included that you can use to retrieve the data.
精彩评论