0

Here is the code i tried

String id = "123456";

    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.putExtra("id", id);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_SUBJECT, "Firebase Deep Link");
    intent.putExtra(Intent.EXTRA_TEXT,deepLinkUri);
    startActivity(intent);

and this is while getting uri details on clicking the link in gmail or message

 FirebaseDynamicLinks.getInstance()
            .getDynamicLink(intent)
            .addOnSuccessListener(this, new OnSuccessListener<PendingDynamicLinkData>() {
                @Override
                public void onSuccess(PendingDynamicLinkData pendingDynamicLinkData) {
                    // Get deep link from result (may be null if no link is found)
                    Uri deepLink = null;
                    if (pendingDynamicLinkData != null) {
                        deepLink = pendingDynamicLinkData.getLink();
                    }


                    // Handle the deep link. For example, open the linked
                    // content, or apply promotional credit to the user's
                    // account.
                    // ...

                    // [START_EXCLUDE]
                    // Display deep link in the UI
                    if (deepLink != null) {
                        Snackbar.make(findViewById(android.R.id.content),
                                "Found deep link!", Snackbar.LENGTH_LONG).show();

                        ((TextView) findViewById(R.id.link_view_receive))
                                .setText(deepLink.toString());
                    } else {
                        Log.d(TAG, "getDynamicLink: no link found");
                    }
                    // [END_EXCLUDE]
                }
            })
            .addOnFailureListener(this, new OnFailureListener() {
                @Override
                public void onFailure(@NonNull Exception e) {
                    Log.w(TAG, "getDynamicLink:onFailure", e);
                }
            });

In onStart to get id on clicking the link from gmail app or message

Intent intent = getIntent();
id = intent.getStringExtra("id");

but it is returning empty ("")

If any please help me

3 Answers3

0

use id = i.getStringExtra("id"); insted of id = intent.getStringExtra(id);

0

put id in "" and also change getIntentData() from intent to i

id = i.getStringExtra("id");

Munir
  • 2,548
  • 1
  • 11
  • 20
0

In onstart from email change the getIntentData() from intent to i.

Also change the key from id to "id".

Intent i = getIntent();
id = i.getStringExtra("id");
Sharath kumar
  • 4,064
  • 1
  • 14
  • 20