Android App: How to read get parameters from a custom url scheme?

匆匆过客 提交于 2019-11-27 00:14:26

问题


Basically, I have the same question described as in How to implement my very own URI scheme on Android

The answer given there works for me. When the custom url is called MyUriActivity's methods onCreate and onStart are called.

BUT

How can I access the get parameters from within MyUriActivity?

Example:

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

In MyUriActivity I need to read the value of get parameter d.

How do I do that?


回答1:


Call getIntent().getData() to retrieve the Uri, then call getQueryParameter("d") on it to get the value of d.



来源:https://stackoverflow.com/questions/17063696/android-app-how-to-read-get-parameters-from-a-custom-url-scheme

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!