I am working on DeepLink on Android. So, I add in my AndroidManifest this code:
<activity android:name=".Home"
android:launchMode="singleTask"
android:screenOrientation="nosensor"
android:theme="@android:style/Theme.NoDisplay">
<intent-filter
android:autoVerify="true"
android:label="@string/app_name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="*XX.XXX.XXX.XXX/api/config"
android:pathPrefix="/newslist/"
android:scheme="https" />
<data
android:host="*XX.XXX.XXX.XXX/api/config"
android:path="/newslist/"
android:scheme="http" />
</intent-filter>
</activity>
Then I add this codes in Home.class:
finish();
Intent intent = getIntent();
String intentData = intent.getDataString();
if (intentData != null && Intent.ACTION_VIEW.equals(intent.getAction())) {
fragment = new FragmentNews();
imageViewHome.setVisibility(View.GONE);
textViewFragmentName.setVisibility(View.VISIBLE);
textViewFragmentName.setText("News");
}
Then, I want to test for DeepLink. I use Android Studio terminal and run this line:
C:\Android\Sdk\platform-tools>adb shell am start -W -a android.intent.action.VIEW -d https://XX.XXX.XXX.XXX/api/config/newslist
But, when I run this code I receive an error:
"Warning: Activity not started, its current task has been brought to the front"
How to solve this problem?