0

My webpage has the following link:

myapp://www.myapp.com/xxxxxx

Desired effect is when clicking on this link from a browser on an Android device and it should detect "myapp" as an custom protocol and directly open MyApp on the device if it's installed.

Launching custom Android application from Android browser / Chrome

Launch custom android application from android browser

I've reseached this topic and found similar questions below to this issue,

They mention to edit section in AndroidManifest.xml, but they do not solve the problem.

The point is it looks like browser is unable to recognize MyApp as a custom protocol.

Community
  • 1
  • 1
user3311838
  • 181
  • 1
  • 1
  • 7
  • Please paste your manifest/ your attempt at adding View Action Intent filters to catch these intents. – sihrc Jun 30 '14 at 22:43
  • Please note above intent filter seems to direct HTTP calls "http://www.cybeye.com" to CybEye the app. But what I want is to define a custom protocol "cybeye://xxx" and only links with such protocol would (not all HTTP calls) would be directed to the app. – user3311838 Jul 01 '14 at 02:22

1 Answers1

0

If you want a link to redirect to your app on your phone: use the a link in the format:

android-app::\\<package name>\<URI segments>

On the phone, it will be parsed into a URI sent to your package (app). In your app, all you need to do is handle these intents.

When it's received by your app, the ACTION_VIEW intent filter should be used to parse URI of:

intent:\\<URI segments>

where intent is your scheme. Simply doing something like below will work.

<intent-filter> <action android:name="android.intent.action.VIEW" /> <data android:scheme="intent" /> <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.BROWSABLE" /> </intent-filter>

For other links that work as a landing page on a web app or a mobile app via browser: http://www.myapp.com/xxx/yyyy

<data android:host="www.myapp/com" android:scheme="http" android:pathPrefix="xxx />

sihrc
  • 2,533
  • 2
  • 17
  • 40