Intercepting links from the browser to open my Android app

前端 未结 3 908
没有蜡笔的小新
没有蜡笔的小新 2020-11-22 14:54

I\'d like to be able to prompt my app to open a link when user clicks on an URL of a given pattern instead of allowing the browser to open it. This could be when the user i

3条回答
  •  深忆病人
    2020-11-22 15:33

    There are some libraries parse parameters from url automatically.

    such as

    https://github.com/airbnb/DeepLinkDispatch

    &&

    https://github.com/mzule/ActivityRouter

    The later one is wrote by me. Which can parse parameters to given type, not always String.

    Example

    @Router(value = "main/:id" intExtra = "id")
    ...
    int id = getIntent().getInt("id", 0);
    

提交回复
热议问题