Not able to getExtras from Intent obtained from ACTION_VIEW

615 Views Asked by At

I am trying to send some Extras in my intent with action as ACTION_VIEW but somehow i am not getting it in the target Activity. I tried putting extras both in bundle and without bundle(directly in intent object itself.)

Here is the Sample Code:

   Intent  intent = new Intent(Intent.ACTION_VIEW);
   intent.setData(Uri.parse("android-app://" + BuildConfig.APPLICATION_ID + "/<scheme>/<host>/<path prefix>/" + item.data.offerId));      
   intent.putExtra(Constants.EXTRA_KEY_IS_SOURCE_ANALYTICS, analyticsString);
   context.startActivity(intent);

Here is how i am trying to obtain String:

    Intent intent =getIntent();
    String action = intent.getAction();
    String data = intent.getDataString();
    if (Intent.ACTION_VIEW.equals(action) && data != null) {
         mAnalyticsSourceString = intent.getStringExtra(Constants.EXTRA_KEY_IS_SOURCE_ANALYTICS);
      }

The intent is successfully delivered to the target Activity and i am using getIntent() to get the Data which is delivered successfully but the value of Contants.EXTRA_KEY_IS_SOURCE_ANALYTICS is always received as null.

0

There are 0 best solutions below