vonatar
vonatar

Reputation: 64

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

The request is send with a GET form, so the query result is

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:

<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? Like servicepoint://tel=0000000000?

Thanks in advance!

Upvotes: 0

Views: 259

Answers (1)

Daniel Zolnai
Daniel Zolnai

Reputation: 16920

getIntent().getData() 

returns the URI which it is called with in the activity, which is opened. So you could basically do something like:

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

Upvotes: 1

Related Questions