0

I am developing an application for searching for places. In the application there is a button where user can share a specific place with other user. I was thinking about sharing a link that when other user, "the invited one", clicks on it, my application opens on the shared place page. Just like Clash Royale game, if you know it. The idea is that. How can I do so? Does anyone have idea how to implement this?

Thanks in advance.

JorgeAmVF
  • 1,660
  • 3
  • 21
  • 32
A.khaled
  • 505
  • 1
  • 5
  • 13

1 Answers1

0

To achieve this you need to Create Deep Links to App Content

Code would be something like this:

1) Add intent filter in your activity

<activity android:name="...">
<intent-filter>    
   <action android:name="android.intent.action.VIEW" />
   <category android:name="android.intent.category.DEFAULT" />    
   <category android:name="android.intent.category.BROWSABLE" />
   <data
     android:host="example.com"
     android:scheme="schemeName" />
   </intent-filter>
</activity>

2) Get data in you activity

Intent intent = getIntent();
String action = intent.getAction();
Uri data = intent.getData();

3) Create sharable URL

 eg - http://example.com?data=<your data to share>

4) Now you need to write some script for your page (http://example.com) that will receive your header data and redirect to open app. for this get some idea from here

* This is not a complete code but hope will help you.

Deven
  • 3,078
  • 1
  • 32
  • 34
  • 1
    Please expand this into a self-contained answer rather than just linking to an off-site resource. – Michael Apr 27 '18 at 07:14