Reputation: 2693
I want to make users able to share their objects with others.
I have an activity that can display the object information with an intent filter like this:
<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" android:host="www.mywebsite.com" />
</intent-filter>
Code for sharing:
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Constants.EXTRA_OBJECT_ID, id);
shareIntent.putExtra(Constants.EXTRA_IS_LOCAL, false);
shareIntent.putExtra(Intent.EXTRA_TEXT, "http://www.mywebsite.com");
startActivity(Intent.createChooser(shareIntent, "Share link using"));
But when i click on this link i can not see my application on "Complete action using" dialog.
Upvotes: 1
Views: 711
Reputation: 93
Currently you trying to send/share the link but you added the intent filter for view in your manifest. So, for view you should set the intent Action to View and then try. Like this:
Intent shareIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.mywebsite.com"));
This is because you have added the intent filter of view category which is:
<action android:name="android.intent.action.VIEW" />
And if you want to share the link then add category of SEND in intent filter like this:
<action android:name="android.intent.action.SEND"/>
I think this will be helpfull for you!
Upvotes: 1