ShareMyLocation
![MIT App Inventor Design Page.JPG](/proxy/?url=https://content.instructables.com/FY6/EB2F/JUEM0HHL/FY6EB2FJUEM0HHL.jpg&filename=MIT App Inventor Design Page.JPG)
This is the layout that I have created for this Location sharing application.
On the first section of this screen, the user can get the Longitude and Latitude of its current location.
By Selecting the Select Contact to Share button, the default contact app of the phone opens up and let the user select the contact to share the location with and next field (textBox) is populated with the contact number of the selected recipient or the user can directly type the contact number of the recipient in the textBox.
By Pressing the Share Location button, the default Messaging app of the phone opens up and let the user send location detail to the recipient.
To create this application, I have used the MIT App Inventor, an intuitive, visual programming environment that allows everyone – even children – to build fully functional apps for smartphones and tablets.
Block Diagram
![Location sensor Logic.JPG](/proxy/?url=https://content.instructables.com/FC4/5GKY/JUEM0HHH/FC45GKYJUEM0HHH.jpg&filename=Location sensor Logic.JPG)
This is the Block Diagram to build the logic of the application.
Sensor Logic
![Location sensor Logic.JPG](/proxy/?url=https://content.instructables.com/FJK/613G/JUEM0I1L/FJK613GJUEM0I1L.jpg&filename=Location sensor Logic.JPG)
In this application, Location Sensor is used to get the User's location. It provides the Longitude and the Latitude of the current location and these inputs are fed to the Map and other labels to display the respective values.
Contact Picker
![ContactPicker Logic.JPG](/proxy/?url=https://content.instructables.com/FE4/JHAW/JUEM0I4H/FE4JHAWJUEM0I4H.jpg&filename=ContactPicker Logic.JPG)
When the ContactPicker button is clicked and any contact is selected, the Contact field is populated with the number of the recipient. Or the User can directly type the contact number of the recipient in the Contact field.
Share Button Logic
![ShareBtnLogic.JPG](/proxy/?url=https://content.instructables.com/FXM/KZWW/JUEM0IYK/FXMKZWWJUEM0IYK.jpg&filename=ShareBtnLogic.JPG)
After pressing the Share Location button:
1.the Message property of Texting object is created and is assigned with the value of Current Address, Longitude, Latitude.
2. the PhoneNumber property of Texting object is created and is assigned with the value of Contact field phone number.
and then SendMessage procedure is called, that invokes the default messaging application of the phone to send the location via text message.
Application Preview on Real Device
![1. Layout and Home Screen.jpg](/proxy/?url=https://content.instructables.com/F98/E4BS/JUEM0K6H/F98E4BSJUEM0K6H.jpg&filename=1. Layout and Home Screen.jpg)
This gives the preview when the app is loaded on a real device.
Selecting Contact
![2. Contact Number Loaded.jpg](/proxy/?url=https://content.instructables.com/FXO/3UT2/JUEM0K6K/FXO3UT2JUEM0K6K.jpg&filename=2. Contact Number Loaded.jpg)
The field just beside the Select Contact to Share is populated with the contact number of the recipient.
Sending the Location
![3. Location Sent via Msg to Recepient.jpg](/proxy/?url=https://content.instructables.com/FAS/U4AQ/JUEM0L5B/FASU4AQJUEM0L5B.jpg&filename=3. Location Sent via Msg to Recepient.jpg)
After pressing the Share Location button, the default messaging app of the phone is invoked and the location detail is sent.
Sharing the App and Testing
![5. Location Received after Distributing the apk from other User.jpg](/proxy/?url=https://content.instructables.com/FBR/2P3K/JUEM0LPI/FBR2P3KJUEM0LPI.jpg&filename=5. Location Received after Distributing the apk from other User.jpg)
I shared this app with my friend and tried to get the location from his phone.
.apk File to Try
Use this .apk file to install the app on your Android Phone and try and test it.