Android custom scheme not working on some devices
Asked Answered
T

1

7

I have made custom scheme for my app by adding this to my activity in the android manifest:

 <activity android:name=".TabHostActivity"
              android:label="@string/app_name"
               android:configChanges="orientation|keyboardHidden">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
         <intent-filter>
            <action android:name="android.intent.action.VIEW" />
                 <category android:name="android.intent.action.DEFAULT" />
                 <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.LAUNCHER" />
                 <data  android:scheme="myscheme" />
        </intent-filter>
    </activity>

When i write "myscheme://" i the android browser it opens my app (on some devices). The problem is that this is not working on the Samsung galaxy s and Xperia play. It only searches for myscheme:// on google.

Does anyone know whats wrong here?

Any help will be appreciated :)

Throughout answered 8/7, 2011 at 15:19 Comment(3)
Is this happening with the same browser on both working and not working devices (eg Chrome), or the stock browser on all devices? It sounds like the default browser for those devices just isn't doing what you expect it to. You can also try running adb -d shell am start -d myscheme://something -a android.intent.action.VIEW to ensure that the intent is being handled properly on the device when you aren't using the browser.Vassal
I think nothing is wrong...you can verify as Tanis.7x said, or make a dummy web page with <a href="myscheme://" ...Polo
Can you try deleting the LAUNCHER category from the intent-filter which specifies your custom scheme and try again? I have used a custom scheme before and the only difference in the declaration is this one. Also the documents dictate that all the categories must be matched during the Intent resolution.Germanous
E
1

It's common for browsers to search for a term or prepend "http://" in front of it if it's not already present. My guess is that's what's happening here.

If you create an HTML page with a link to myscheme://something, your app should show up in the chooser list.

Something like this: <a href="myscheme://it_worked"> click this link </a>

Elegant answered 13/7, 2013 at 4:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.