0

I use a local town public transport service and it also offers an SMS ticket service that I find pretty easy to use. One thing I dislike about it is remembering every single code for particular routes (the codes are simple unless I'm on the street). I would like to bookmark it somehow and register in my (web browser?) bookmarks or my contacts. RFC 5724 suggests a special SMS URI that generally is:

sms:$SERVICE_PHONE_NUMBER?body=$TICKET_REQUEST_CODE

e.g., sms:1234?body=5678 in my case. I was trying to add such a bookmark in Google Chrome hoping to add a bookmark widget to the home screen, but Chrome interprets it as an HTTP URI trying to open a web site. I was also trying to add the bookmark to Google Contacts as a special "web site" field for the dedicated contact, but it didn't work either as if it were an HTTP URI.

My question is, is it possible to bookmark an sms: scheme URL on Android so I could use predefined SMS messages with predefined recipients and predefined text bodies?

If it's worth noting, I use QKSMS. It seems to declare sms and other protocols intent filtering, but for whatever reason it does not work for me.


Edit 1.

As a test workaround I've just created a simple HTML page, and it seems to work:

<a href="sms:1234?body=5678">5678</a>

Saving the page to the device and adding a shortcut to the file on the home screen seems to do what I want very and very closely, and clicking the link opens QKSMS with proper recipient and text body. I only don't really like the idea of having a static HTML file on my device because it may be hard to maintain in case of necessity. So it turns out that Google products do not work well here?

6
  • @Robert thanks for the idea, but unfortunately it won't work too: Chrome and other apps would still think it's an HTTP URL. I've just described a workaround I was thinking of earlier, but I find it an overkill to some extent. BTW, adding double slashes to the href attribute won't work properly: QKSMS parses it as a part of the recipient number. Commented Oct 8, 2020 at 11:56
  • @Robert thanks for a great idea! I probably could also create a bunch of concrete scripts to start the default SMS app just like you're suggesting (this comes to my mind first but with some security concerns, not sure if such an intent app exists, but there are tools like SManager that allow to add script runners as widgets). Or, as an option of last resort, I could just write a simple Android application with hard-coded intents. Commented Oct 8, 2020 at 13:20
  • @Robert I just found how I can create favorites in Intent (krow.dev.scheme) and create home screen shortcuts that do exactly what I want! Your idea is truly brilliant! Thank you very and very much! Commented Oct 8, 2020 at 13:54
  • Does the sms scheme work as I posted with sms://1234it or did you use sms:1234?
    – Robert
    Commented Oct 8, 2020 at 14:23
  • @Robert QKSMS, at least on my real device, is unable to parse double-slashed URLs properly (the recipient number would consist of prepended // and appended ?, literally //1234?). However, I also quick-tested the am command you suggested on an Android x86 5.1 virtual machine and the stock SMS app can parse double slashes leniently as if there were no slashes. Commented Oct 8, 2020 at 15:34

1 Answer 1

1

On Android the communication between the web browser and the sms app bases on "Intents".

based on your description the problematic component in this set-up is the web browser. Hence using a different app that can send Intents to other apps or using the adb shell can be helpful for testing out SMS links directly.

There a a lot of apps in Google PlayStore that can send Intents to other apps, for example Intent.

If you want to try adb (Android Debug Bridge) use the following command to sens an sms intent:

adb shell am start -a android.intent.action.VIEW -d sms:1234?body=5678

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .