By Felix

Use an <intent-filter> with a <data> element. For example, to handle all links to twitter.com, you'd put this inside your <activity> in your AndroidManifest.xml:

<intent-filter>   <data android:scheme="http" android:host="twitter.com"/>   <action android:name="android.intent.action.VIEW" /> </intent-filter> 

Then, when the user clicks on a link to twitter in the browser, they will be asked what application to use in order to complete the action: the browser or your application.

Of course, if you want to provide tight integration between your website and your app, you can define your own scheme:

<intent-filter>   <data android:scheme="my.special.scheme" />   <action android:name="android.intent.action.VIEW" /> </intent-filter> 

Then, in your web app you can put links like:

<a href="my.special.scheme://other/parameters/here"> 

And when the user clicks it, your app will be launched automatically (because it will probably be the only one that can handle my.special.scheme:// type of uris). The only downside to this is that if the user doesn't have the app installed, they'll get a nasty error. And I'm not sure there's any way to check.


更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. 关于小机器人
  2. Android中app的请求抓包工具 Fiddler 详
  3. Delphi在Android下通过WiFI进行调试
  4. Android笔记Android基于事件监听器处理机
  5. 图解Android和Linux发行版的区别
  6. 一行命令从 APK 文件中提取 Endpoint 及
  7. Qt for Android使用grpc探索
  8. android. MVC三层分层
  9. android ListView 设定背景图后拖动时整
  10. Android amr语音编解码解惑