25

I want my app to open on http://www.example.com and https://www.example.com.

This works:

            <data
                android:host="www.example.com"
                android:path="/"
                android:scheme="http"/>

            <data
                android:host="www.example.com"
                android:path="/"
                android:scheme="https"/>

Is it possible to catch both with one entry? I tried:

            <data
                android:host="www.example.com"
                android:path="/"
                android:scheme="http*"/>

but this catches only the http link, not the https one.

So I know how I can handle bot variants, but want to use the most concise writing possible.

4
  • It is not possible i think Commented Sep 14, 2016 at 9:25
  • I am also think, it's not possible. Commented Sep 14, 2016 at 9:41
  • I don't think this field support regex, but you could try android:scheme="https?" Commented Sep 14, 2016 at 15:37
  • Also this could work: <data android:host="www.example.com" android:path="/"/> <data android:scheme="http"/> <data android:scheme="https"/> Commented Sep 14, 2016 at 15:39

2 Answers 2

31

This seems to do the trick for me:

<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" />
    <data android:scheme="https" />
    <data android:host="www.mywebsite.com" />
    <data android:pathPrefix="/mypage.php" />
</intent-filter>
1
  • not working for me. It show me /build/app/outputs/flutter-apk/app-debug.apk: Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]
    – Abir Ahsan
    Commented Feb 1 at 22:01
4

You can use seperate <intent-filter> for both

<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="www.example.com"
            android:path="/"
            android:scheme="http"/>     
</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="www.example.com"
            android:path="/"
            android:scheme="https"/>     
</intent-filter>
3
  • 1
    That's what I wanted to avoid, I wanted to have the shortest (in terms of characters in my manifest) possibility.
    – fweigl
    Commented Sep 14, 2016 at 9:40
  • sometimes you cannot avoid, except if you are going to change OS coding :)
    – Ravi
    Commented Sep 14, 2016 at 9:43
  • 1
    I have added that but stilll my app is not uploading Commented Jul 8, 2017 at 9:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.