0

i want to create a deep link when user press a share button i share a link like this--(example url) https://www.myapp.com/Home_page (I had purchased a domain and my app is also available on play store) and want when user click on this link they should be redirected to the Home_page activity of my app but as i click page not found is displayed.

my code for manifest is:-

  <activity
        android:name="com.rakuso.earningadds.Activities.Home_page"
        android:configChanges="orientation|screenSize|keyboardHidden">
    <intent-filter android:autoVerify="true">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="http://"
            android:host="www.myapp.com"
            android:pathPrefix="/Home_page"></data>

    </intent-filter>
 </activity>

now i cant understand what should i do

Sachin Rajput
  • 4,326
  • 2
  • 18
  • 29
swarnima
  • 69
  • 1
  • 2
  • 9

1 Answers1

1

Use this as IntentFilter.

<intent-filter android:autoVerify="true">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="http"
                android:host="www.myapp.com"
                android:pathPrefix="/Home_page"></data>

            <data android:scheme="https"
                android:host="www.myapp.com"
                android:pathPrefix="/Home_page"></data>
        </intent-filter>

Also read AutoVerify property if you are not using it intentionally.

To handle deep link in Activity

  @Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Intent intent = getIntent();
    String action = intent.getAction();
    Uri data = intent.getData();
}

Or if your Activity is android:launchMode="singleTask" then you have also check in onNewIntent()

 @Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    String action = intent.getAction();
    Uri data = intent.getData();
}

Read Deep linking.

ADM
  • 20,406
  • 11
  • 52
  • 83
  • should i have to do any thing in my activity page to receive intent – swarnima Jan 11 '18 at 05:55
  • Thanks for your answer...it worked if the app is installed on my device but it is also required that if the app is not installed on the device it will go to play store....how to do this – swarnima Jan 11 '18 at 06:06
  • This has to implement at server site .You can use Firebase Depplinking . Read [This](https://stackoverflow.com/questions/28744167/android-deep-linking-use-the-same-link-for-the-app-and-the-play-store) . If this answer helped you then upvote and accept the answer .Thx – ADM Jan 11 '18 at 06:12
  • this is opening link in the browser, not redirecting to application, I am trying to access link from mail – Amin Pinjari Oct 22 '19 at 13:35