Skip to first unread message

Ren Lenox

unread,
Dec 29, 2016, 9:31:21 PM12/29/16
to MIT App Inventor Forum
Is it possible to get any random location which is retrieve from gps (location 1), then used a compass to get to the location from your current location using below coding example. The location 1 is not static or constant.

and is it possible to combine this two code exapmle?

https://www.google.com/url?q=https%3A%2F%2Fpuravidaapps.com%2Fsnippets.php%232bearing&sa=D&sntz=1&usg=AFQjCNGXn22KUh5_Rjmsj5KU5Vag4bWjuA

http://appinventor.pevest.com/?p=1297

Thanks.

SteveJG

unread,
Dec 29, 2016, 9:55:27 PM12/29/16
to MIT App Inventor Forum
Sure.   You could build the compass tutorial and learn how to get it to point in a particular direction using the LocationSensor latitude and longitude as the start location and your 'random' geocoordinates as the destination.

You might also want to look at these MIT tutorials that show how to use the LocationSensor, learn how gps works and put it all on a map.

Android, Where's My Car? for App Inventor 2

You parked somewhere near the stadium, but when the concert ends you don't have a clue where the car is. Fortunately you haven't lost your Android phone that never forgets anything, and you remember you have the hot new app, Android, Where's My Car?. With this app, you click a button when you park your car, and the Android uses its location sensor to record the car's GPS coordinates and address. Later, when you reopen the app, it shows you a map from where you are to the remembered location-- problem solved! With this tutorial you'll be able to download a created app and then study the annotated blocks below to better understand the app and App Inventor programming in general. This app covers: GPS, TinyDB, and using Activity Starter to open a map.

Advanced
Map It: Displaying Locations on a Google Map

This tutorial shows how you can develop an app that allows you to record list of addresses and view the address on the Google Maps. It will also show you how view your current location on the Google Map.

Advanced
Exploring with Location Sensor in AI2

The location sensor object is used to communicate with the global positioning satellite receiver (GPS) in your phone/tablet. When the LocationSensor communicates with the built-in GPS receiver, the GPS can determine the location of your device.  The sensor can also work with network/wifi location services.  Finding a location using the network uses very different techniques to determine a location. Location means, the device's present latitude and longitude or it can mean your street address.




Yes, you can combine elements of one tutorial with another however before you do that, we recommend you build the tutorial to learn how stuff works. You might particularly want to combine elements of the compass tutorial with the code in Android Where is my Car.    For your car's location, substitute the geocoordinates you want to navigate to.

Once you learn the principles using these tutorials, you will find there are better methods for doing what you want by building a purpose built app, perhaps using the ActivityStarter or WebViewer and building a static map with multiple 'random' locations you want to hike to.  You can even calculate the straightline distance to the point using spherical geometry, the haversine algorithm or other Earth model.

Regards,
Steve
Reply all
Reply to author
Forward
0 new messages