2

My app is designed to work with various Amazon links but for some reason it has started to always open links instead of the Android system asking every time.

If I click a link on the Amazon website in Chrome my app opens. If I click an Amazon link in an email my app opens.

In my settings I have Android set to Ask every time for Amazon (see screenshot) but it's acting as though it is set as the default.

What's odd is that my app didn't used to do this, and it sometimes doesn't do it now (though only very occasionally) and instead asks as you would expect. But 95% of the time my app launches automatically.

Now I'm getting reports from users of the same thing.

Is it possible for something in the manifest to cause this (I wouldn't have thought so as that could effectively allow app hijacking) or are my OS settings (and those of the users reporting the problem) messed up?enter image description here

Manifest.xml below:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.nooriginalthought.amalfi">

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

    <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="AmALfi" android:largeHeap="true" android:resizeableActivity="true" android:supportsPictureInPicture="true" android:theme="@style/AppTheme">

    <activity android:name="com.nooriginalthought.amalfi.MainActivity" android:configChanges="orientation|screenSize" android:screenOrientation="portrait" android:launchMode="singleTop" android:theme="@style/AppTheme">

        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>

        <intent-filter android:label="@string/generate_affiliate_link_with_amalfi">
            <action android:name="android.intent.action.SEND"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <data android:mimeType="text/plain"/>
        </intent-filter>

        <intent-filter android:label="@string/generate_affiliate_link_with_amalfi">
            <action android:name="android.intent.action.SENDTO"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <data android:host="*.amazon.ae" android:scheme="http"/>
            <data android:host="*.amazon.ae" android:scheme="https"/>
            <data android:host="*.amazon.ca" android:scheme="http"/>
            <data android:host="*.amazon.ca" android:scheme="https"/>
            <data android:host="*.amazon.co.uk" android:scheme="http"/>
            <data android:host="*.amazon.co.uk" android:scheme="https"/>
            <data android:host="*.amazon.com" android:scheme="http"/>
            <data android:host="*.amazon.com" android:scheme="https"/>
            <data android:host="*.amazon.com.au" android:scheme="http"/>
            <data android:host="*.amazon.com.au" android:scheme="https"/>
            <data android:host="*.amazon.com.br" android:scheme="http"/>
            <data android:host="*.amazon.com.br" android:scheme="https"/>
            <data android:host="*.amazon.com.mx" android:scheme="http"/>
            <data android:host="*.amazon.com.mx" android:scheme="https"/>
            <data android:host="*.amazon.de" android:scheme="http"/>
            <data android:host="*.amazon.de" android:scheme="https"/>
            <data android:host="*.amazon.es" android:scheme="http"/>
            <data android:host="*.amazon.es" android:scheme="https"/>
            <data android:host="*.amazon.fr" android:scheme="http"/>
            <data android:host="*.amazon.fr" android:scheme="https"/>
            <data android:host="*.amazon.in" android:scheme="http"/>
            <data android:host="*.amazon.in" android:scheme="https"/>
            <data android:host="*.amazon.it" android:scheme="http"/>
            <data android:host="*.amazon.it" android:scheme="https"/>
            <data android:host="*.amazon.jp" android:scheme="http"/>
            <data android:host="*.amazon.jp" android:scheme="https"/>
        </intent-filter>

        <intent-filter android:label="@string/generate_affiliate_link_with_amalfi">
            <action android:name="android.intent.action.VIEW"/>
            <data android:host="*.amazon.ae" android:scheme="http"/>
            <data android:host="*.amazon.ae" android:scheme="https"/>
            <data android:host="*.amazon.ca" android:scheme="http"/>
            <data android:host="*.amazon.ca" android:scheme="https"/>
            <data android:host="*.amazon.co.uk" android:scheme="http"/>
            <data android:host="*.amazon.co.uk" android:scheme="https"/>
            <data android:host="*.amazon.com" android:scheme="http"/>
            <data android:host="*.amazon.com" android:scheme="https"/>
            <data android:host="*.amazon.com.au" android:scheme="http"/>
            <data android:host="*.amazon.com.au" android:scheme="https"/>
            <data android:host="*.amazon.com.br" android:scheme="http"/>
            <data android:host="*.amazon.com.br" android:scheme="https"/>
            <data android:host="*.amazon.com.mx" android:scheme="http"/>
            <data android:host="*.amazon.com.mx" android:scheme="https"/>
            <data android:host="*.amazon.de" android:scheme="http"/>
            <data android:host="*.amazon.de" android:scheme="https"/>
            <data android:host="*.amazon.es" android:scheme="http"/>
            <data android:host="*.amazon.es" android:scheme="https"/>
            <data android:host="*.amazon.fr" android:scheme="http"/>
            <data android:host="*.amazon.fr" android:scheme="https"/>
            <data android:host="*.amazon.in" android:scheme="http"/>
            <data android:host="*.amazon.in" android:scheme="https"/>
            <data android:host="*.amazon.it" android:scheme="http"/>
            <data android:host="*.amazon.it" android:scheme="https"/>
            <data android:host="*.amazon.jp" android:scheme="http"/>
            <data android:host="*.amazon.jp" android:scheme="https"/>

            <category android:name="android.intent.category.DEFAULT"/>
            <category android:name="android.intent.category.BROWSABLE"/>
        </intent-filter>

        </activity>

        <activity android:name="com.nooriginalthought.amalfi.ManageAffIdsActivity" android:configChanges="orientation|screenSize" android:screenOrientation="portrait" android:theme="@style/AppTheme"/>

        <activity android:name="com.nooriginalthought.amalfi.PreviewLinkActivity" android:configChanges="orientation|screenSize" android:screenOrientation="portrait"/>

    </application>
</manifest>
anatoli
  • 1,663
  • 1
  • 17
  • 43
Fat Monk
  • 2,077
  • 1
  • 26
  • 59
  • put your manifest here – anatoli Oct 01 '19 at 11:30
  • where is the screenshot? – Makarand Oct 01 '19 at 11:30
  • @anatoli can the manifest override the OS option to ask every time? If not then surely the manifest is not relevant. – Fat Monk Oct 01 '19 at 11:33
  • @FatMonk have you set Amazon in your manifest as [follow](https://stackoverflow.com/a/38286501/3237946) ? WHERE is screeenshot for `In my settings I have Android set to Ask every time for Amazon (see screenshot)` ? – anatoli Oct 01 '19 at 11:48
  • StackExvhange app failed to upload screenshot. Added now. – Fat Monk Oct 01 '19 at 12:29
  • still is manifest very helpfull..... What is your standard browser? have you there setted, that your app should be opened if amazon link clicked? If by opening of some link (or mime type) there is **only one** application, that could open it, **then** it will be opened without asking. – anatoli Oct 01 '19 at 12:31
  • Manifest now added. It's bug hence not wanting to include it. Browsers on device are chrome, Firefox and Firefox preview. App opens from links in any browser and email. – Fat Monk Oct 01 '19 at 12:42
  • Arrgghh.. typos everywhere. Above comment should read "Manifest now added. It's big hence not wanting to include it." – Fat Monk Oct 01 '19 at 14:27

1 Answers1

0

You have set one activity for android:mimeType="text/plain" and as Browser.

Split both in owns Activities

You have probably set that your app is standard for text/plain and so it will be always opening as browser

anatoli
  • 1,663
  • 1
  • 17
  • 43
  • 1
    That can't be the problem for a couple of reasons. The unwanted opening is when clicking an Amazon URL. Amazon URLs do not return `text/plain` mime types. Also the app is not even presented as an option for opening `text/plain`. The `text/plain` intent in the manifest is for share (send) intents. Clicking a link is a `VIEW` intent, as far as I understand, and so if this was a problem in the `intent-filter` it would be within the `action.VIEW` section. – Fat Monk Oct 01 '19 at 13:24