Hello all,
I would like to share with you my first app created as part of an online course I'm taking at my work place.
The task was to develop a Map Location App that sends a text message to your chosen contact with your current location.
We also needed to share our app to the App Inventor community.
So let's start :)
There are 3 main part for my app:
- The phone number -
- So I gave the user 2 options in this part:
- Enter manually the number - as it sounds, user just need to type in the number of his chosen contact
- Or Choose from your contact list - I used the "Social option of "PhoneNumerPicker", which when pressed, shows you the contact list on your device, from which you can choose
- I also added a "Clear" button in case user want the option to send several times, without the need to manually delete the number/contact he chose.
![Screenshot_20190421-160428__01.jpg](https://groups.google.com/group/mitappinventortest/attach/b16ef6a479948/Screenshot_20190421-160428__01.jpg?part=0.1&view=1)
- And the code behind all of that:
- Choose from contact
![Choose contact from devide.PNG](https://groups.google.com/group/mitappinventortest/attach/b16ef6a479948/Choose%20contact%20from%20devide.PNG?part=0.2&view=1)
- Clear button
![Clear your choise.PNG](https://groups.google.com/group/mitappinventortest/attach/b16ef6a479948/Clear%20your%20choise.PNG?part=0.3&view=1)
- The Map -
- I used the "Maps" -> "Map" option as to show my map. Very basic I think, nothing special here
- I choose to show the location of the user on the map and a compass.
- In order to be able to get the location on the map, I had to add the "Sensors" -> "LocationSensor" option.
- This one enables the map to actual show the user and to refresh the map according to the refresh time interval of your choice.
- This is how the map looks in the app:
![Screenshot_20190421-160428 (2).jpg](https://groups.google.com/group/mitappinventortest/attach/b16ef6a479948/Screenshot_20190421-160428%20(2).jpg?part=0.4&view=1)
- And this is the code to "Initialize location"
![Initialize Location.PNG](https://groups.google.com/group/mitappinventortest/attach/b16ef6a479948/Initialize%20Location.PNG?part=0.5&view=1)
- The "Send" button -
- It use is very simple:
- At first, I choose the "send Message" option, which turned out to be very annoying. As each time I pressed the button, I was transfer to my default texting app, where there I needed to press again the "Send" button of the app, in order for my message to send out.
- So after some digging, I found out there is a better option (at least for me) which is "sendMessageDirect". This option enables you to send the text message directly from your app. Only difference, is that it needs a special permission to read/write messages. I saw no issue in my case, as I built a very simple app. Of course, this should be a concern when you are building an app which you want others to use.
- If there is a number in the designated place - send the message and show a success message on screen
![Screenshot_20190421-160722__01.jpg](https://groups.google.com/group/mitappinventortest/attach/b16ef6a479948/Screenshot_20190421-160722__01.jpg?part=0.6&view=1)
- If there is no number - show an error message on screen and don't send anything
![Screenshot_20190421-160434.jpg](https://groups.google.com/group/mitappinventortest/attach/b16ef6a479948/Screenshot_20190421-160434.jpg?part=0.7&view=1)
- And the code behind it:
![Send Location.PNG](https://groups.google.com/group/mitappinventortest/attach/b16ef6a479948/Send%20Location.PNG?part=0.8&view=1)
That's it.
I hoped you enjoyed my post, and that it was helpful for you :)