Spoetnic
Spoetnic

Reputation: 584

Android App Intent Filter sometimes not working

For a project I have encountered a very strange issue:

Deeplinks have been working very well for the last year, but recently (since the beginning of January-2019) we have been getting complaints from our users that deeplinks have stopped working (some say 9 out of 10 time).

We have not changed any of this code and have great difficulty reproducing this issue.

Even stranger, in the sparse times that we do encounter the issue ourselves, the android OS does not even show our app as an option through the 'open with'-dialog. This suggest to us that the OS sometimes forgets that the app has intent-filters registered in its Manifest.

Restarting the app appears to fix this and deeplinks start working again. The app also seems to work every time we do a new build from Android Studio, which makes it very hard to reproduce.

Our manifest has a specific activity that handles deeplinks:

<activity
    android:name="com.company.DeepLinkActivity"
    android:noHistory="true"
    android:launchMode="singleTask">
    <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="ideal-payment"
            android:scheme="com.company.ideal" />
        <data
            android:host="ideal-payment"
            android:scheme="com-company-ideal" />

    </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="${appLinkIdealHost}"
            android:pathPrefix="/ideal-betaling/landingpage"
            android:scheme="https" />
    </intent-filter>

    <intent-filter android:autoVerify="true">
        ...
    </intent-filter>

    <intent-filter android:autoVerify="true">
        ...
    </intent-filter>
</activity>

We thought it might have something to do with the autoVerify not being accessible, but then the OS should show the 'open with'-dialog, which does not happen when the issue surfaces.

Is there someone that has encountered a similar issue? Any help or suggestions would be greatly appreciated.

Upvotes: 6

Views: 4547

Answers (4)

Spoetnic
Spoetnic

Reputation: 584

Great news, we were able to find a solution. The issue originated from an older version of the Chrome browser. https://bugs.chromium.org/p/chromium/issues/detail?id=935864

After the release of version 73.0.3683.90 a few days ago, the issue has gone away. Thanks Google :D

Upvotes: 0

Martin Zeitler
Martin Zeitler

Reputation: 76569

these two entries also look strange to me, not sure what you are trying to accomplish there:

<data android:host="ideal-payment" android:scheme="com.company.ideal" />
<data android:host="ideal-payment" android:scheme="com-company-ideal" />

this is far from being ideal, because those hosts and schemes are both invalid, see data-element.

I would assume, based upon all the code which obviously had been withheld... that other intent-filter might also feature duplicate data elements, which would need to be moved into separate intent-filter, of which an activity element permits several. set android:autoVerify="true" on all these intent-filter and then closely review the logcat after the package installation.

Upvotes: 1

Amani
Amani

Reputation: 3969

When app is stopped for example with an exception or when user have force stopped it from settings or in some devices when user removes app from history (or from tasks) the app will be force stopped automatically (which is not a good choice from manufacturer) when app is in stopped state its manifest intentFilter will not be used (when app is first installed and never opened also it is in this phase)

While in stopped state, the application will not run for any reason, except by a manual launch of an activity, or an explicit intent that addresses an activity ,service or broadcast.

https://riptutorial.com/android/example/30592/android-stopped-state


Most of Android versions you mentioned was 8 or grater thus below quotation also may be useful but this is for services and broadcast receivers.

Whenever an app runs in the background, it consumes some of the device's limited resources, like RAM. This can result in an impaired user experience, especially if the user is using a resource-intensive app, such as playing a game or watching video. To improve the user experience, Android 8.0 (API level 26) imposes limitations on what apps can do while running in the background.

https://developer.android.com/about/versions/oreo/background

Upvotes: 1

deeppandya
deeppandya

Reputation: 123

Can you specify the version of android OS ? because android:autoVerify="true" works only on Android 6.0 and higher to cause the system to attempt to verify all hosts associated with the URLs in any of your app's intent filters.

Upvotes: 0

Related Questions