Reputation: 3149
I added this code to my manifest, in order to handle sharing from Instagram to my application:
<activity android:name=".ActivityHandlingFragments">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
And the following code is censed to handle the sharing (this function is called in onCreate(...) { ... }
:
public void handleIntent() {
Intent intent = getIntent();
if(intent != null) {
Toast.makeText(getApplicationContext(), intent.getStringExtra("XYZ"), Toast.LENGTH_LONG).show();
}
}
By what could I replace XYZ
in the above code? In other words: is there any list of all the data that Instagram passes into its implicit intent?
Note: https://www.instagram.com/developer/mobile-sharing/android-intents/ lists only intents from an application to Instagram (I want to contrary!).
Using getExtras()
method, I discovered there is only one extra: android.intent.extra.TEXT
, which contains the URL of the Instagram publication that is shared from Instagram to my app.
So, to get it, write: String url = intent.getStringExtra("android.intent.extra.TEXT");
Waiting for confirmations...! :) In particular: is there any legal mean to get the image (or video), the comments and the legend of the publication (the legend is the text the Instagramer write while posting the image or video and it appears just below the media, and above the comments)?
Upvotes: 1
Views: 405
Reputation: 3149
Using getExtras()
method, I discovered there is only one extra: android.intent.extra.TEXT
, which contains the URL of the Instagram publication that is shared from Instagram to my app.
So, to get it, write: String url = intent.getStringExtra("android.intent.extra.TEXT");
Waiting for confirmations...! :) In particular: is there any legal mean to get the image (or video), the comments and the legend of the publication (the legend is the text the Instagramer write while posting the image or video and it appears just below the media, and above the comments)?
Upvotes: 2