0

I have an Android application that can be launched from the configured App Link.

My app properly got launched as a separate app by clicking a link from a browser or from other email clients like Gmail etc.

But with Outlook, when I tap on a link from the email, my app got launched within the Outlook app. See the screenshot.

enter image description here

On the other hand, if I just click on a YouTube video link from Outlook, the YouTube app got launched as a separate app.

I have following Android Manifest file:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
    android:allowBackup="false"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    android:usesCleartextTraffic="true">

    <provider
        android:name=".GenericFileProvider"
        android:authorities="${applicationId}.provider"
        android:exported="false"
        android:grantUriPermissions="true">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/provider_paths" />
    </provider>

    <activity
        android:name=".MainActivity"
        android:theme="@style/AppThemeNoActionBar"
        android:resizeableActivity="false">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
            <data android:host="xx.xxxxx.com" android:scheme="https" />
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
        </intent-filter>
    </activity>

    <activity
        android:name=".WebActivity"
        android:configChanges="orientation|screenSize"
        android:theme="@style/AppThemeNoActionBar" />
        
    <activity
        android:name="com.zos.sigcapesign.SplashActivity"
        android:theme="@style/AppThemeNoActionBar" />

</application>

After some searching I tried to change the launch mode value in manifest as follows: android:launchMode="singleTask"

This resolves the issue of launching my app inside Outlook and my app started launching as a separate app. But it came up with new issues.

After setting the launch mode to singleTask, my app only got launched first time. Now if my app is already launched and I click the link again, the app got launched with a blank white screen. In the debugger the MainActivity is not even hit. So nothing happens in the app and I have to revert back the launch mode to standard.

So, for me the issue and the question remains that why my Android app is opening inside Outlook application?

rizzz86
  • 3,862
  • 8
  • 35
  • 52

1 Answers1

0

I am able to figure out the issue and resolved it.

I have used launch mode as signleTask

The point that I was missing is, when the app is re-launched with App Link, the onNewIntent() function get called instead of onCreate(). So I have to handle the App Link case inside onNewIntent() function.

Now all is good. I am able to launch my app as a separate app from Outlook, Browser, Gmail clients etc.

rizzz86
  • 3,862
  • 8
  • 35
  • 52