I am using deep linking to share my active link to different applications like WhatsApp. The problem is I want to share 2 different activities. Now I am able to share them but if we assume I will share activity A. After clicking on the link, I will see my application option well that's fine and it will take me to activity A.
But now if I do share to activity B.When I try to click on the link, my application will appear twice at one time, and if I choose what was previously chosen by activity A, it will take me to my activity A.This is a wrong choice, so the requested activity will not work.
See the pictures for clarification this is activity A:
And this is activity B here problem :
As you can see my app come at two time.
So what is the problem are there anyone know solve to this problem help me.
this is manifest code:
<!-- 1-->
<activity
android:name=".FragmanM.MainActivityM" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<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:scheme="http"
android:host="============"
android:pathPrefix="/post" />
</intent-filter>
<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:scheme="https"
android:host="==============="
android:pathPrefix="/post" />
</intent-filter>
</activity>
<!-- 2 -->
<activity
android:name=".FragmantA.MainActivityA" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<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:scheme="http"
android:host="================"
android:pathPrefix="/posts" />
</intent-filter>
<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:scheme="https"
android:host="==============="
android:pathPrefix="/posts" />
</intent-filter>
</activity>
this activity A
Uri data =getActivity(). getIntent().getData();
if (data!= null) {
try {
post_id = data.getLastPathSegment().toString();
getPost(post_id);
} catch (NumberFormatException e) {
post_id=null;
}
}
Bundle bundle = getActivity().getIntent().getExtras();
if (bundle !=null){
if(post_id==null){
post_id =bundle.getString("mid");
getPost(post_id);
}
}
this is activity B
Uri data =getActivity(). getIntent().getData();
if (data!= null) {
try {
posts_id = data.getLastPathSegment().toString();
getPost(posts_id);
} catch (NumberFormatException e) {
posts_id=null;
}
}
Bundle bundle = getActivity().getIntent().getExtras();
if (bundle !=null){
if(posts_id==null){
posts_id =bundle.getString("moid");
getPost(posts_id);
}
}