Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to properly create an Intent to refer like Tez?

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?enter image description here

like image 939
Manoj Perumarath Avatar asked Mar 29 '18 08:03

Manoj Perumarath


People also ask

How do I send an intent?

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.

What is the use of intent createChooser () method?

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 .

How do I send intent to another app?

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.


1 Answers

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

like image 130
Janku Avatar answered Sep 30 '22 18:09

Janku