2

I am using Firebase deep-linking for content sharing in my android app and it working perfectly. Now I want to use Firebase App invite to invite friends to download and signup on my app. Now I have some problems.

1) Firebase App invite provides only two way to invite friends (SMS and Email). But I also want to share with WhatsApp, FB etc.

2) If above case not possible then if I am using deep-linking with the custom parameter with App play store link then how to get those parameters on the app first launch after installing from play store?

Please suggest.

Satwinder Singh
  • 627
  • 1
  • 6
  • 23

2 Answers2

1

1) Firebase App invite provides only two way to invite friends (SMS and Email). But I also want to share with WhatsApp, FB etc.

yes, it's possible to share via whatsApp, fb etc, Actually once you generate the link you can create your own share intent and share that link, you can create the links manually also refer this

2) If above case not possible then if I am using deep-linking with the custom parameter with App play store link then how to get those parameters on the app first launch after installing from play store?

use pendingDynamicLinkData that you get in your callback to get the those custom parameters you set.

 FirebaseDynamicLinks.getInstance()
            .getDynamicLink(getIntent())
            .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();
//get your properties here
                    }
                }
            })
            .addOnFailureListener(this, new OnFailureListener() {
                @Override
                public void onFailure(@NonNull Exception e) {
                    Log.w(TAG, "getDynamicLink:onFailure", e);
                }
            });

you can query it even after a while too as a second option. https://firebase.google.com/docs/reference/dynamic-links/analytics

Aniruddha K.M
  • 7,361
  • 3
  • 43
  • 52
  • 1) I know I can create own share intent but Firebase app invite provides only two option SMS or email.Check firebase documentation: [link](https://firebase.google.com/docs/invites/) And here is code to for app invite action : 2) This is exactly I am using right now for deep-linking. But my question is how to get those parameters after app installed from play store. Because play store doesn't pass those parameters on the app first open. – Satwinder Singh Oct 25 '17 at 06:53
  • yes it does, as an out of the box solution and the reason is because of this https://firebase.google.com/docs/invites/best-practices check out Build a custom share sheet section in that link – Aniruddha K.M Oct 25 '17 at 06:56
  • can you post where you are inserting those params – Aniruddha K.M Oct 25 '17 at 07:01
  • Yes you are right, we can build a custom sheet section for other channels but I don't know how to create and launch that sheet with this code: ` private void onInviteClicked() { Intent intent = new AppInviteInvitation.IntentBuilder("Invite friends") .setMessage("samdlkknaslkdnlas") .setDeepLink(Uri.parse("https://www.example.com")) .build(); startActivityForResult(intent,4); }` – Satwinder Singh Oct 25 '17 at 07:04
  • this link talks about it https://developer.android.com/distribute/best-practices/grow/get-referrals-firebase-invites.html using this key EXTRA_INITIAL_INTENTS you can find more info here https://developer.android.com/reference/android/content/Intent.html#EXTRA_INITIAL_INTENTS – Aniruddha K.M Oct 25 '17 at 07:18
  • https://stackoverflow.com/questions/5734678/custom-filtering-of-intent-chooser-based-on-installed-android-package-name/8550043#8550043 refer this on how to do the above – Aniruddha K.M Oct 25 '17 at 07:21
  • Thank u for your suggestions. My problem is solved already by using deep-linking. Previously I had a doubt that maybe play store doesn't return deep-links query parameters but now I have tested and it does. Thank you anyways :) – Satwinder Singh Oct 25 '17 at 11:55
  • sure, glad i could help happy coding – Aniruddha K.M Oct 25 '17 at 13:01
0

It is possible (but not perfect) using the user's IP address. Note I'm not familiar enough with firebase to know whether you could use firebase for this instead of your own server:

  1. Configure a page on your own website so that it:
    1. Reads and stores the URL parameters (e.g. "source=facebook&invite=123") and the user's IP.
    2. Redirects the user to Google Play.
  2. Configure the android app to query or update your website upon first launch.

When your app is launched, the user's IP address will be sent back to your server. Your website now knows that it was probably the user with that invite code who launched the app.

Of course there are cases where users share IP addresses (e.g. office workers going through the same router), but this is the best solution I've been able to come up with so far.

cobberboy
  • 5,598
  • 2
  • 25
  • 22