How to implement my very own URI scheme on Android

后端 未结 5 714
借酒劲吻你
借酒劲吻你 2020-11-22 06:12

Say I want to define that an URI such as:

myapp://path/to/what/i/want?d=This%20is%20a%20test

must be handled by my own application, or serv

5条回答
  •  忘了有多久
    2020-11-22 07:10

    Another alternate approach to Diego's is to use a library:

    https://github.com/airbnb/DeepLinkDispatch

    You can easily declare the URIs you'd like to handle and the parameters you'd like to extract through annotations on the Activity, like:

    @DeepLink("path/to/what/i/want")
    public class SomeActivity extends Activity {
      ...
    }
    

    As a plus, the query parameters will also be passed along to the Activity as well.

提交回复
热议问题