Skip to content Skip to sidebar Skip to footer

Android How To Create Custom Url Scheme With The Given Format Myapp://http://

I have researched through most of the custom URL scheme Q&A and I have not found my possible answer. I want my app to be launched by clicking a certain URL in the browser (any

Solution 1:

As CommonsWare said the given URI upon I needed to create a Scheme is not a valid URI thus the scheme didn't not work and the application didn't launch. After this explanation the server side guys were convinced to change the URI to myapp://... and it worked like magic :).

The Activity looks like this now :

<activityandroid:name="com.myapp.test.SplashScreen"android:exported="true"android:label="@string/app_name"android:screenOrientation="portrait"android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" ><intent-filter><actionandroid:name="android.intent.action.MAIN" /><categoryandroid:name="android.intent.category.LAUNCHER" /></intent-filter><!-- Test for URL scheme --><intent-filter><actionandroid:name="android.intent.action.VIEW" /><categoryandroid:name="android.intent.category.DEFAULT" /><categoryandroid:name="android.intent.category.BROWSABLE" /><dataandroid:scheme="myapp" /></intent-filter><!-- End Test for URL scheme --></activity>

Solution 2:

That's a misuse of the URI scheme and is invalid. The HTTP URL you want to pass is a piece of data and should thus be sent in the query string.

myapp://somehost/action?url=http%3A%2F%2Fwww.name.com%2Fpath%2Fpath2%2F

Solution 3:

you need use a hyperlink to start the app . for example ,you set scheme="yourpackagename" ,you need to set a hyperlink like this: yourpackagename://host ,and you should vist the hyperlink on you moble browser .If you do not have host lable,just remove it.

<!-- Test for URL scheme --><intent-filter><actionandroid:name="android.intent.action.VIEW" /><categoryandroid:name="android.intent.category.DEFAULT" /><categoryandroid:name="android.intent.category.BROWSABLE" /><dataandroid:host="host"android:scheme="yourpackagename" /></intent-filter><!-- End Test for URL scheme -->

If your activity has more than one scheme, you should use 2 or more to specify it

Post a Comment for "Android How To Create Custom Url Scheme With The Given Format Myapp://http://"