How to listen for a custom URI

后端 未结 3 600
野的像风
野的像风 2020-11-30 09:10

I am working on an application which has its own URI prefix. (dchub:// in this case)

Searching all over and read a lot but I got a bit confused.

Is it possible

3条回答
  •  没有蜡笔的小新
    2020-11-30 09:55

    Try this code:

    try {
        Uri data = getIntent().getData();
        if (data.equals(null)) { 
        } else { 
            String scheme = data.getScheme();
            String host = data.getHost();
            int port = data.getPort(); 
            //type what u want
            tv.setText("any thing");
         }      
    } catch (NullPointerException e) {
          // TODO: handle exception
      tv.setText("Null");
    }
    

提交回复
热议问题