launch application from browser url scheme

Thanks to many good posts, I have bee trying to launch my Android app from a browser link using the following code. Please help me adjust the manifest and href to call my application –

Manifest

  • How to restrict TextView to allow only alpha-numeric characters in Android
  • Android Map V2 - Why MAPS_RECEIVE permission
  • Strings don't seem to be equal in Java on Android, even though they print the same
  • Life cycle of Android Activity after pressing Back button
  • Gradle and Multi-Project structure
  • Android rxJava Error handling with retrofit
  • <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.afs"
      android:versionCode="1"
      android:versionName="1.1">
      <supports-screens
      android:largeScreens="true"
        android:normalScreens="true"
        android:smallScreens="false"
        android:resizeable="true"
        android:anyDensity="true"/>
    <uses-permission android:name="android.permission.INTERNET"></uses-permission>
    <uses-permission android:name="android.permission.CALL_PHONE"></uses-permission>
    <uses-permission android:name="android.permission.SEND_SMS"></uses-permission>
    <uses-permission android:name="android.permission.WRITE_SETTINGS"></uses-permission>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
    <uses-permission android:name="android.permission.MODIFY_PHONE_STATE"></uses-permission>
    <uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>
    <uses-sdk android:minSdkVersion="9"></uses-sdk>
    <application android:label="@string/app_name" android:icon="@drawable/afs"        android:debuggable="true">
          <activity android:name=".afs"
                  android:label="@string/app_name"
                  android:configChanges="keyboardHidden|orientation"
            android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
             <intent-filter>
                 <data android:scheme="afs.com.afs"/>
                 <data android:name="android.intent.action.VIEW" />
                 <category android:name="android.intent.category.DEFAULT" />
                 <category android:name="android.intent.category.BROWSABLE" />
             </intent-filter>    
        </activity>
    </application>
    

    HTML code

    <a href="afs.com.afs:75235">Launch Application</a>
    

  • How to force stop my android application programmatically?
  • Why logcat is not showing anything?
  • Difference between android.R.layout.simple_spinner_dropdown_item and android.R.layout.simple_spinner_item
  • Android notifyDataSetChanged
  • Disable one key on custom keyboard in Android
  • Android browser scaling?
  • One Solution collect form web for “launch application from browser url scheme”

    Attributes from documentation scheme://host:port/path or pathPrefix or pathPattern.

    You need to change define proprely scheme and host definition. If you don’t specify scheme then all URI attributes will be ignored, and won’t be applied.

    You could use http URI scheme.

        <data android:scheme="http" android:host="afs.com.afs"/>
    

    and in HTML

    <a href="http://afs.com.afs:75235">Launch Application</a>
    

    Or define own URL scheme.

        <data android:scheme="myapp" android:host="afs.com.afs"/>
    

    and in HTML

    <a href="myapp://afs.com.afs:75235">Launch Application</a>
    

    PS.

    Change this

        <data android:name="android.intent.action.VIEW" />
    

    to

        <action android:name="android.intent.action.VIEW" />
    
    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.