简体   繁体   English

Android Web Wiew和自定义URL方案

[英]Android Web Wiew and Custom URL Scheme

I have a WebView App that point on my site (it's for a service for tech support and PC repair) Users can see their status by compiling the form ( http://service-lab.com/ServicePointHelpDesk/index.php#cerca ) with mobile number 我的网站上有一个WebView应用程序(用于技术支持和PC维修服务),用户可以通过编译表单( http://service-lab.com/ServicePointHelpDesk/index.php#cerca )来查看其状态。手机号码

The request is send with a GET form, so the query result is 该请求以GET形式发送,因此查询结果为

http://service-lab.com/ServicePointHelpDesk/cerca.php?tel=3316282871

Ok, for now it's all ok and working..Automatically when the status change, the customer is notified with a mail, and i want that the link open the app with the result query. 好的,现在一切都很好,并且可以正常工作。当状态改变时,自动向客户发送邮件通知,我希望该链接打开带有结果查询的应用程序。

http://service-lab.com/ServicePointHelpDesk/cerca.php?tel=3316282871

I've set up a CustomURL with this way: 我通过以下方式设置了CustomURL:

<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:scheme="servicepoint"></data>
</intent-filter>

If i go to servicepoint:// the app starts correctly, but how can i process the PHP query? 如果我转到servicepoint://,应用程序将正确启动,但是如何处理PHP查询? Like servicepoint://tel=0000000000? servicepoint://tel=0000000000?

Thanks in advance! 提前致谢!

getIntent().getData() 

returns the URI which it is called with in the activity, which is opened. 返回在活动中被打开的URI。 So you could basically do something like: 因此,您基本上可以执行以下操作:

URI uri = getIntent.getData();
if (uri != null){
  String telephoneNumber = uri.getQueryParameter("tel");
  ...
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM