Sunday, 13 January 2019

Sending an SMS via Intent in Android

Alchemy allows users to donate to their chose charities via text message, which it used to do automatically using Android's SmsManager functionality. Unfortunately, Google have recently updated the Play Store's terms and conditions to restrict SMS_READ and SMS_SEND to applications whose primary purpose is to act as an alternative SMS application on Android (replacing the usual Messages app for example).

I applied for an excemption for Alchemy, but this wasn't granted. This is understandable I think - Android security has a lot of issues, and excess permissions is definitely one of them - Alchemy is a good citizen and only interacts with a single SMS number, but a malicious applicaiton could easily use the same permissions for nefarious purposes.

Without an exemption, there was no choice but to update Alchemy to avoid using SmsManager. This meant instead requesting an existing SMS app to send the donation SMS instead - via an intent. It took me some time to find out exactly how to do this, but the code required to pre-populate an SMS for a user to send is

Uri uri = Uri.parse("smsto:" + charity.getNumber());
Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
intent.putExtra("address", charity.getNumber());
intent.putExtra("sms_body", keyword);
intent.putExtra("exit_on_sent", true);
if (intent.resolveActivity(getPackageManager()) != null) {
    startActivityForResult(intent, 1);
    donationViewModel.recordDonation(this.donations, charity.getName(), smsKeywordToDonation(charity.getCost(keyword)));
} else {
    Toast.makeText(this, "No SMS provider found", Toast.LENGTH_SHORT).show();

The full code can be found on Github. Note that, unfortunately, SMS applications generally do not seem to respect the "exit on sent" request, so the user must navigate back manually. A bonus for this change is that Alchemy now doesn't require any additional permissions from the user. Previous donations must now be stored in Alchemy itself, instead of using SMS history. This may cause some loss of data in the migration, but should result in more robust behaviour from now on.


  1. GPS applications that give kids a simple frenzy catch to advise guardians that there is a crisis, and they require help are by a long shot the best alternatives. sms bomber apk

  2. That’s a nice share. You should definitely be harnessing the collective strength of marketing approaches for the growth of your business. I am really happy that slack to sms app is absolutely wonderful for my business. It is very effective and very affordable as well.

  3. I’m happy I located this blog! From time to time, students want to cognitive the keys of productive literary essays composing. Your first-class knowledge about this good post can become a proper basis for such people. nice one Tubidy Video APK Download Latest version Free

  4. Wow, cool post. I'd like to write like this too - taking time and real hard work to make a great article... but I put things off too much and never seem to get started. Thanks though. Download prince of persia iso ppsspp

  5. I just got to this amazing site not long ago. I was actually captured with the piece of resources you have got here. Big thumbs up for making such wonderful blog page! cyberflix

  6. As it is only a start, we don't know of how fruitful it is. In any case, one thing we can say is that the client experience will improve in future with the dispatch of Instant Apps. download itools crack

  7. Great work. That’s a nice share. You should definitely be harnessing the collective rel="nofollow" Thunderball resultsstrength of marketing approaches for the growth of your business.Can you please give me more information about this.

  8. Whatever the occasion or the purposes, there's one SMS message in this vast collection that will suit you and your purposes. Friends SMS Sharing

  9. I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post. blackmart apk free download 2016

  10. I admire this article for the well-researched content and excellent wording. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much. smart glass

  11. The motivation behind why such a large number of phones bomb so early is on the grounds that individuals throw them around, recklessly place them on racks, and just when all is said in done don't deal with them as the exceptionally refined bits of innovation that they are. Iphone reparatur Kiel

  12. Be that as it may, the client is allowed to pick their own launcher and customize their telephones. mx player

  13. Accounting Software for the self employed businessman in the UK does not have to be complex. There are different requirements to double entry bookkeeping that anyone self employed may fulfil and Accounting Software available to satisfy those requirements. The most important requirement of any Accounting Software purchased by a self employed businessman being the automated production of the Self Assessment tax return. site

  14. SMS Bomber APK made it easy for us to send many messages at a time. Best bomber apk is a real joy for the people to create some fun with your friends and family

  15. Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too. best texting service

  16. Yahoo mail is an web based email service. Yahoo mail service can be accessed through different devices including computer, tablets, smart phones, and more. Users with a valid Yahoo account can sign into Yahoo com to access the features of Yahoo mail. A smile web browser can be used to sign into Users can also download Yahoo app to their mobile phone and login to their account. yahoo mail sign in


AWS Keyspaces - Managed Cassandra review

AWS recently went live with Keyspaces, their managed version of Cassandra ( ). This service is primarily a...