Make a link in the Android browser start up my app?

前端 未结 9 1123
小鲜肉
小鲜肉 2020-11-21 22:06

Is it possible to make a link such as:

click me!

cause my Anton app to start

9条回答
  •  感情败类
    2020-11-21 22:49

    Here's my recipe:

    Create a static HTML that redirects to your requested app URL, put that page on the web.

    That way, the links you share are 'real' links as far as Android is concerned ( they will be 'clickable').

    You 'share' a regular HTTP link, www.your.server.com/foo/bar.html This URL returns a simple 8 line HTML that redirects to your app's URI (window.location = "blah://kuku") (note that 'blah' doesn't have to be HTTP or HTTPS any more).

    Once you get this up and running, you can augment the HTML with all the fancy capabilities as suggested above.

    This works with the built-in browser, Opera, and Firefox (haven't tested any other browser). Firefox asks 'This link needs to be opened with an application' (ok, cancel). Other browsers apparently don't worry about security that much, they just open the app, no questions asked.

提交回复
热议问题