Multiple Same Apps and Deep Linking - java

I have implemented deep linking in my app. I added this intent filter in my manifest file, and the deep linking is working fine.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="xxxxxxxx"
android:scheme="xxxxxxxx" />
</intent-filter>
The problem is that through deep linking, when i click on my App, it is showing similiar kinds of apps.
It is happening when Open by DEFAULT is not set
But when the open by default is set then everything is working fine.

Try this way ..
Suppose when user call http://example.com that time my Mainactivity open then all required attribute define inside mainactivity.
<activity android:name=".LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name = ".MainActivity" >
<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="example.com"/>
</intent-filter>

Related

How to open an app directly from deeplink if app is installed already?

I want to open app directly without giving propmt open with browser or open with app.
I followed some links on stackoverflow did exactly what they did but still no luck.
Please help to get it fixed.
<activity
android:name="com.zappfresh.android.Activity.login.SplashActivity"
android:label="Zappfresh"
android:launchMode="singleTask"
android:screenOrientation="portrait">
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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:host="zappfresh.onelink.me"
android:pathPrefix="/T0HX"
android:scheme="https" />
</intent-filter>
</activity>

How to make my Android app appear in the app chooser when clicking an email link in a WhatApp chat

I'm building an Android app that I want to appear in the app chooser when clicking an email address in a WhatsApp chat.
I tried various intent filters and even tried to change my app id in the gradle file since I read here that WhatsApp whitelists some apps, but none of this solution worked.
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SENDTO"/>
<data android:scheme="mailto"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<data android:mimeType="*/*"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE"/>
<data android:mimeType="*/*"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<data android:scheme="mailto"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
applicationId "com.google.android.gm.test"
I expect that when I click an email address sent to me in a WhatsApp my app will appear in the app chooser, but it doesn't.
Does anyone have any input?

Issue in detecting application from website

I want to detect whether application is present or not from website.
Facing issue in detecting application from website,there is no event on button click this is my piece of html code:
click here
Launch App
</a>
and this is piece of code in Manifest File:
<activity
android:name=".activity.SplashScreenActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data android:scheme="startci" />
<action android:name="com.xyz.CUSTOMACTION" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
Appreciate for help.There is very less solution regarding this issue and not getting proper solution.

Android Studio generates three separate apps after I compiled and ran in the android emulator

I have upgraded my Android studio.
I think there is something different from the previous version
When I finished writing the code and compile then run. I look something different like this:
Whether it's something new or I destructive my android studio settings
May be you create multiple intent-filter in android AndroidManifest.xml.
this is happening because you have posted below code in three different activities in AndroidManifest.xml file.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
the mistake you have done is like below in AndroidManifest.xml file:
<activity
android:name=".SplashActivity"
android:launchMode="singleTop"
android:screenOrientation="sensorPortrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".HomeActivity"
android:launchMode="singleTop"
android:screenOrientation="sensorPortrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:screenOrientation="sensorPortrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

Intercepting a url to launch application

I am trying to intercept a url so that my application opens up when user accesses the URL. I am following this answer in a related question https://stackoverflow.com/a/2958870
I've added the following in AndroidManifest.xml
<activity
android:name="com.myapp.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<data android:scheme="http" android:host="myapp.com"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
And have the following in onCreate of MainActivity.java
Uri data = getIntent().getData();
//String scheme = data.getScheme();
//String host = data.getHost();
if (data == null)
Log.d("Data is null", "");
else
Log.d("Data is not null", "");
When I launch the app in the emulator I am noticing that the "Data is null" debug message is coming. I had to comment out the scheme and host because that was causing my application to fail on load time and the reason for I guess was because data was null.
Am I missing something or doing something wrong?
Edit: I've tried splitting the intent-filter like this:
<activity
android:name="com.myapp.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</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:host="myapp.com" android:scheme="http" />
</intent-filter>
</activity>
Also, when I just have one intent-filter (below) my app does not even launch on the emulator when I press run in android studio.
<activity
android:name="com.myapp.MainActivity"
android:label="#string/app_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="myapp.com" android:scheme="http" />
</intent-filter>
</activity>
Try this intent filter instead:
<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="myapp.com" android:scheme="http" />
</intent-filter>
This is an implicit intent, but I tried it and it worked for me. I think you need the android.intent.category.BROWSABLE category.

Categories

Resources