Google Maps API vs MIT APP INVENTOR

1,354 views
Skip to first unread message

John Smithh

unread,
Dec 29, 2016, 7:09:50 AM12/29/16
to MIT App Inventor Forum
I'm trying to work on an app that shows the user the closest drug store to his location in time of needs. Of course, I decided to use Google maps app Inventor but whenever I click on the map in app it redirects me to the API web page.. Anyone used Google Maps API before in MIT APP INVENTOR ? Are there any sort of solutions ? thanks

SteveJG

unread,
Dec 29, 2016, 8:56:48 AM12/29/16
to MIT App Inventor Forum
Very many people use the Google Maps API in conjunction with AI2 John.  Most of them have learned how to use the LocationSensor and ActivityStarter to do this.  AI2 does NOT have the tools to automatically click on a location on a Google Map and to retrieve information about it such as the closest drug store without coding.

Have you done any of the tutorials showing how a developer can use AI2 to work with locations?
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.



The ActivityStarter can be used to display map locations.  Please read the descriptions.


You can write your own code using the Google Static Map API to plot locations using information about locations of drug stores (but you cannot touch a location and get information about it ) .  You use a math algorithm to calculate the straight-line distance to the location of interest .   It is also to possible to pull up Google's Navigate using AI2 or you can eliminate the Google Location API using the ActivityStarter and do a Web search (provided the device is connected using WIFI or a Data connection:

Launch a Web search

To launch a Web search, use an ActivityStarter with the WEB_SEARCH action.  The user’s phone will display a menu asking what kind of search to perform:

Action: android.intent.action.WEB_SEARCH



where the user can specify by typing in drug store and the search will pull up all nearby drug stores.    Do some experimenting.

With plain vanilla App Inventor 2, you cannot use the Google API to do exactly what you want to do.  You can do many other things with the API and using either the WebViewer or the ActivityStarter.  AI2 cannot do all the things a professional compiler like Android Studio is capable of.


Regards,
Steve

Reply all
Reply to author
Forward
0 new messages