In my app i have to add an intent to share my app. I looked through Tez, which shares the app icon along with a text which contains a hyperlink. How to achieve this?
When you construct an intent, you must specify the action you want the intent to perform. Android uses the action ACTION_SEND to send data from one activity to another, even across process boundaries. You need to specify the data and its type.
The system will always present the chooser dialog even if the user has chosen a default one. If your intent created by Intent. createChooser doesn't match any activity, the system will still present a dialog with the specified title and an error message No application can perform this action .
Yes , you can send the intent to any app you like but its upto the receiving application to handle it. Few apps may crash receiving it. pick any one and try it by passing as a second argument to the intent constructor defined above and then call startActivity method. hope it helps you.
you can try this one..
Uri uri = Uri.fromFile(imageFile);
Intent intent1 = new Intent();
intent1.setAction(Intent.ACTION_SEND);
intent1.setType("image/*");
intent1.putExtra(android.content.Intent.EXTRA_SUBJECT, "App Name");
intent1.putExtra(Intent.EXTRA_TEXT, "Download the app from google play store now - "+ APP_STORE_URL);
intent1.putExtra(Intent.EXTRA_STREAM, uri);
try {
startActivity(Intent.createChooser(intent1, "Share"));
} catch (ActivityNotFoundException e) {
Toast.makeText(getContext(), "please try again", Toast.LENGTH_SHORT).show();
}
this will works : put image file and text box in share intent
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With