| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
scheme是android中的一种页面内跳转协议,方便app页面的内的跳转
客户端应用可以向操作系统注册一个 URL scheme,该 scheme 用于从浏览器或其他应用中启动本应用。通过指定的 URL 字段,可以让应用在被调起后直接打开app 内的某个页面。综上URL Scheme使用场景大致分以下几种:
<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:host="keno.android.oauthapp"
android:path="/login"
android:port="2202"
android:scheme="oauth">
</data>
</intent-filter>private void startOAuth() {
Intent intent = new Intent(Intent.ACTION_VIEW);
StringBuilder urlSb = new StringBuilder();
String scheme = "oauth";
String host = "keno.android.oauthapp";
String path = "/login";
int port = 2202;
//携带参数
String accountParam = "keno@gmail.com";
int idParam = 9527;
urlSb.append(scheme).append("://").append(host).append(":").append(port).append(path)
.append("?account=").append(accountParam)
.append("&id=").append(idParam);
intent.setData(Uri.parse(urlSb.toString()));
startActivity(intent);
}
| Back | FazBrowse Home | New Git URL |