user1920582
user1920582

Reputation: 245

redirect app when open custom url in browser android

How to make redirect my app without dialog (Choose Option) when user open custom url like this

https://signin.ebay.com/ws/eBayISAPI.dll?ThirdPartyAuthSuccessFailure&isAuthSeccesfull=true&ebaytkn=&tknexp=1233-4503223

I've tried to using intent filter in my android manifest like this

 <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="https" 
                android:host="signin.ebay.com" android:pathPattern="/ws/eBayISAPI.dll?/ThirdPartyAuthSuccessFailure&amp;isAuthSuccessful=true*"/>
            <data
                android:scheme="http"
                android:host="signin.ebay.com" android:pathPattern="/ws/eBayISAPI.dll?/ThirdPartyAuthSuccessFailure&amp;isAuthSuccessful=true*"/>

        </intent-filter>  

but its not working , but when I've tried code like this

 <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="https" 
                android:host="signin.ebay.com" />
            <data
                android:scheme="http"
                android:host="signin.ebay.com"/>

        </intent-filter>  

its working but it show dialog ChooseOption sometimes I open browser with url https://signin.ebay.com or http://signin.ebay.com

How to make when user open url this

https://signin.ebay.com/ws/eBayISAPI.dll?ThirdPartyAuthSuccessFailure&isAuthSeccesfull=true&ebaytkn=&tknexp=1233-4503223

they will redirect to my app WITHOUT dialog box ChooseOption , my tknexp is not static remember , thanks

Upvotes: 0

Views: 2558

Answers (1)

Brijesh Thakur
Brijesh Thakur

Reputation: 6788

It is asking to choose option because you have given android:scheme="https". Because of this Android will look for applications , which supports android:scheme="https" and will show user if there are multiple application taking care of thie scheme.

To Avoid it change the android:scheme="https" to android:scheme="<your own scheme>" which is handled by only you app. This will redirect directly to you application.

Now in your activities onCreate method you will receive the URL with instead of https://. But now you have total control on url , you can change it to https://.

Upvotes: 1

Related Questions