how to add custom schema URL to “sms_body”

2019-08-04 10:38发布

问题:

I want to send a sms message that contain custom schema URL :

For example: samuel://ace?id=dddfsdfsdfsdfs

When the addressee clikc this URL, it will launch my application.

My question is that how can I add the hyperlink to "sms_body" ?

Any people have the relative experience ? In other words, Can you give me some suggestions?

回答1:

Don't use samuel://ace?id=dddfsdfsdfsdfs. Use http://samuel.org/ace?id=dddfsdfsdfsdfs. In your Android application, have an activity that responds to ACTION_VIEW, with the BROWSEABLE category, with an appropriate <data> element to match on the scheme, host, and path. Also create a Web page on your Web server that explains the value of your application and why they should install it.

This way:

  • Your link will be clickable automatically
  • Your link will work on all devices, including non-Android devices
  • Your link will still open your desired activity when the user has your application installed

Here is a sample application showing some of this.