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.
Step 1: Block Diagram
This is the Block Diagram to build the logic of the application.
Step 2: Sensor Logic
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.
Step 3: Contact Picker
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.
Step 4: Share Button Logic
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.
Step 5: Application Preview on Real Device
This gives the preview when the app is loaded on a real device.
Step 6: Selecting Contact
The field just beside the Select Contact to Share is populated with the contact number of the recipient.
Step 7: Sending the Location
After pressing the Share Location button, the default messaging app of the phone is invoked and the location detail is sent.
Step 8: Sharing the App and Testing
I shared this app with my friend and tried to get the location from his phone.
Step 9: .apk File to Try
Use this .apk file to install the app on your Android Phone and try and test it.