Android 中Scheme协议的使用详解唤起App

  • 1.Scheme是一种页面内跳转协议;通过定义自己的scheme协议,可以非常方便跳转app中的各个页面。

  • 2.什么时候使用
    1.服务器下发跳转路径,客户端根据服务器下发跳转路径跳转相应的页面
    2.APP根据URL跳转到另外一个APP指定页面。

  • 3.格式
    myscheme://myhost:8888/macthDetail?macthId=222&name=hello

  • 4.app中使用

                	//三个action必填
                    <action android:name="android.intent.action.VIEW"/>
                    <category android:name="android.intent.category.DEFAULT"/>
                    <category android:name="android.intent.category.BROWSABLE"/>
                    <data android:scheme="myscheme"
                        android:host="myhost"
                        android:port="8888"
                        android:path="/macthDetail"/>
    
    
  • 5.调用

    Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse("myscheme://myhost:8888/macthDetail?macthId=222&name=hello"));
    startActivity(intent); 
    
    

猜你喜欢

转载自blog.csdn.net/qq_39735878/article/details/126040663