Opening intent on Sharing

I want to share a link so that when the other user clicks that link, it opens my app with some Intent data that I can process.

 Intent i= new Intent(android.content.Intent.ACTION_SEND);
 i.setType("text/plain");
 i.putExtra(android.content.Intent.EXTRA_SUBJECT,"Subject");
 i.putExtra(android.content.Intent.EXTRA_TEXT, "xyz.com/blah");

 i.putExtra("important stuff", "important stuff");

 startActivity(Intent.createChooser(i, "Share via"));

I have also added this in manifest:

<intent-filter>
   <action android:name="android.intent.action.VIEW" />
   <category android:name="android.intent.category.DEFAULT" />
   <category android:name="android.intent.category.BROWSABLE" />
   <data android:scheme="http" />
   <data android:scheme="https" />
   <data android:host="xyz.com" />
</intent-filter>

So on clicking the shared text, my app opens up. Now I want to work in my app according to the important stuff. However, on clicking it, (e.g. from Whatsapp), I only get the following in the received intent.

String name: com.android.browser.application_id

Value in key: com.whatsapp

How can I get back the important stuff I sent on the intent?


ANSWERS:


How can I get back the important stuff I sent on the intent?

You don't.

While you are certainly welcome to put random extras on Intents, do not expect other apps to do anything with them. In particular, there is nothing in the ACTION_SEND documentation requiring implementers of ACTION_SEND to do anything with random extras, let alone somehow get them back to you.

Similarly, while you are welcome to invent new HTTP headers, there is no requirement that a Web server pay attention to them, let alone send them back to you in a response.

Instead, replace xyz.com/blah with xyz.com/important/stuff (or possibly xyz.com/blah?important=stuff), and get the data out of the Uri used to start your activity. You get this Uri via getIntent().getData() in your activity's onCreate() method (or possibly getData() on the Intent passed to onNewIntent(), depending on your manifest settings and whether an existing instance of this activity already exists).



 MORE:


 ? NodeJs proprietary lib and extensions
 ? AudioGraph throws XAUDIO2_E_INVALID_CALL on second frame input node
 ? Get data from another UWP application
 ? How to relaunch a Windows 10 IoT app programmatically
 ? How do I declare a System data type in UWP/RT XAML?
 ? App Icon in "All Apps" blurred
 ? Scan QR Codes on Windows 10 IoT (Raspberry Pi)
 ? How to convert between char* and Platform::String^?
 ? Visual Studio 2015 Update 1 xaml designer not showing for UWP
 ? Create Windows 10 ControlTemplate in code-behind file