0

I'm not even sure if this is possible, but this is what I would like to do.

Give the user an option to share some content (such as an inventory item). This is easy enough to do with and Intent using ACTION_SEND. However, if the other person has the same app installed the link should take them to my app and pass in what data was sent to them (so the app can show it to them). If they don't have the app, it should take them to the app store to encourage them to download the app.

Is this possible, and if so how is it done?

yitzih
  • 3,018
  • 3
  • 27
  • 44

2 Answers2

1

As described in this link : Create Deep Links

You should add this in your manifest :

<activity
    android:name="com.example.android.GizmosActivity"
    android:label="@string/title_gizmos" >
    <intent-filter android:label="@string/filter_view_http_gizmos">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <!-- Accepts URIs that begin with "http://www.example.com/gizmos” -->
            <data android:scheme="http"
                  android:host="www.example.com"
                  android:pathPrefix="/gizmos" />
            <!-- note that the leading "/" is required for pathPrefix-->
        </intent-filter> 
</activity>

and then share a link that starts with "http://www.example.com/gizmos" (fake url) with another person.

  • and for the time when the app is not installed you should create a redirect rule to google play at the server side, that is described in this link (https://stackoverflow.com/a/28792160/9981067) – fatemeh fallahi arezoudar Jun 24 '18 at 07:53
0

Yes it is possible by handling adding state parms in your url and then redirecting to play store from your server side code.

eg - your app generates url which points to some user profile -

https://www.yourSocialNewtwork.com/profile/sandeshDahake

Step 1 - Create a deep link in your app with intent filter. This will handle your app is already installed and pass params to it -

<data android:scheme="https"
          android:host="www.yourSocialNewtwork.com"
          android:pathPrefix="/profile" />

Step2 - If app is not installed you can redirect to play store from your server side

https://developer.android.com/google/play/installreferrer/library#java

https://play.google.com/store/apps/details?id=com.profile.yourHierarchy &referrer=sandeshDahake

I have heard there are some opensource projects which handle this scenario but not explored them yet.

Basically trick here is proper url structure and deep linking. https://developer.android.com/training/app-links/deep-linking

sandesh dahake
  • 1,028
  • 7
  • 16