开发者

extras intent in broadcast receiver

开发者 https://www.devze.com 2023-03-01 06:10 出处:网络
I want to to know how to extras intent value in broadcast receiver onReceive method... @Override public void onReceive(Context context, Intent intent) {

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消