android, Browser 의 링크를 통해 내 앱 실행시키기 |
Declare Intent-filter on Manifest
The activity which wants to be started has to have action name "android.intent.action.VIEW".
Additionally, it has two basic category; they are android.intent.category.DEFAULT and android.intent.category.BROWSABLE.
To link the url to the activity, intent-filter has to have data and it declares one or some of followings : scheme, host, port, path.
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="myapp" android:host="myapp.com"/>
</intent-filter>
For testing.
<html>
<body>
<a href="myapp://myapp.com">Click to lead apk</a>
</body>
</html>
Keep it mind that WebView with manual html document does not support such a link.
You should try this one on the real web page.
How to get additional info?
Via getIntent().getData() you can get uri.
So if you want to pass some parameters, you can just add it with the agreement of the app developer.
'프로그래밍 놀이터 > 안드로이드, Java' 카테고리의 다른 글
[android] PackageManager 와 ActivityManager. 그리고 Intent 이야기 (0) | 2013.11.08 |
---|---|
[android] ImageView ScaleType Tutorial (2) | 2013.11.07 |
[android] pulltorefreshlistview both side setting. (0) | 2013.11.05 |
[android] intra app communication method statistics. ( localbroadcastmanager, eventbus, otto ) (0) | 2013.11.04 |
[android] Bitmap too large to be uploaded into a texture (0) | 2013.10.31 |
댓글