Java (intent) to MIT App Inventor

Hi. I am fairly new to coding and MIT app inventor in general, so I need a comprehensible response to my question :slight_smile:

Can someone help me convert this code into MIT app inventor code? This is Java code.

Intent setSmsAppIntent =
new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT);
startActivityForResult(setSmsAppIntent, your-result-code);

I am trying to display the following permission request (go to the link for more details):

The way to use intents with App Inventor 2 is to use the ActivityStarter . Use the advice Using the Activity Starter


Hi Steve. Thank you so much for your reply. I actually explored combinations of code and tried a few different things out with the activity starter and actually referenced this website. However, since I am so inexperienced, I have a lack of understanding as to what to do and what exactly everything means :sweat_smile:. Here’s what I experimented with, but I have no clue if it’s correct.

This code did not work.

You might try something like described here . The example shows the way you should be usingthe AS blocks. Will it work? No idea, Google has changed the way ‘dangerous’ intents can be used several time in the past few years. Try it. Let us know what happens.

– Steve

So, upon looking through the thread, it seems like with that code, the SMS is not sent directly and requires manual intervention? My app uses the SendMessageDirect block to send an SMS without manual intervention and manual intervention defeats the purpose of my app. I was trying to use the activity starter to make my app a default SMS handler because obviously Google Play rejected my app due to their policies. What do you think I should do?

  • Use Companion 2.57bu to send message Direct and do not distribute your app on GooglePlay. The app will work if installed on an Android manually. If you want to use GooglePlay, obviously you cannot use because of Google’s policies.

  • Accept the fact that your app will require manual intervention to send the sms using the SendMessage Block. Release that on GooglePlay.

  • Petition GooglePlay to allow your app to be a default SMS handler. Based on comments in the forum, acceptance is probably unlikely; but you could try.

– Steve

Thank you so much for all the help!

A post was merged into an existing topic: Sending notifications and saving them

you can’t set your MIT App Inventor app as default app to receive SMS… this would require to keep your app running in the background, which is not really possible for App Inventor apps
see also chapter “requirements for default handler”


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

Ohhh ok… I understand the problem now! Thank you for the clarification. I have figured out an alternative to the text though so that I can still release my app on Google Play. Thanks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.