如何添加自定义 MIME 类型?

2026-01-26 19:42:01

android:name="MainActivity"

android:label="@string/app_name"

android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >

android:scheme="http" >

现在,当您收到文本为"http://{your mime}.com"的短信或者点击带有此文本的网页链接时,您的活动(MainActivity)将会启动。

您也可以添加参数:

text = "http://{your mime}.com/?number=111";

然后在 onCreate() 或 onResume() 方法中添加以下代码:

Intent intentURI = getIntent();

Uri uri = null;

String receivedNum = "";

Log.d("TAG", "intent= "+intentURI);

if (Intent.ACTION_VIEW.equals(intentURI.getAction())) {

if (intentURI!=null){

uri = intentURI.getData();

Log.d("TAG", "uri= "+uri);

}

if (uri!=null)

receivedNum = uri.getQueryParameter("number");

}

Copyright © 2022 世界杯奖杯_男足世界杯预选赛 - cbatop.com All Rights Reserved.