2016년 12월 14일 수요일

App that uses google maps PROBLEM


I already made a part of the app that lets you press the button of the point that you are interested in and opens google maps and shows you near, for example bars, if you have pressed the oubs and bars button. I'm trying to make it alert you everytime you walk near a Point that you have selected (I'll make a button for options and there you wouldbe able to select which points you are interested in to get alerts). The Points could be museums, bars, restaurants, banks, etc. 

Help me please. I already know how to get my current location and I need to make something that alerts me when I'm 100-200 meters from a point.

-- 
It depends.  Are the geocoordinates of your 'bars' loaded in your app or are you using the Google Business Maps API?

If you provide your own geocoordinates:
1. you could use a Clock to run a Procedure that calculates the straight-line distance between the current location and the geocoordinates of the bar. When the distance is < 150 meters, sound an alarm or vibrate the phone. Calculate a distance using simple trig or  using the  Haversine formula.
2) Make a ring-fence.   The following shows how to use a ring-fence properly http://www.appinventor.org/bookChapters/chapter18.pdf  in the section called Programming Complex Conditions
3) Using the LS DistanceInterval property to determine how close your device is to a certain point  (google the forum for a discussion that mentioned   Halte Alarm ..Christophe solved his problem that way.)  DistanceInterval is discussed in the LS tutorial
4) Use the Google Maps API to bring up Google Navigate where if you have the CurrentAddress, you can ask it to navigate with AI2 code and an activitystarter I believe.

If you use the Google Business Maps API I have no suggestions.

Anything here work for you Maria?

Merry Christmas

-- 
Well I tried to do what you said (I also saw Christophs bus app solutions) but i can't find a way to get all the lat long of the nearby locations (museums, restaurants, hotels, etc..). 
I want to choose if I am interested in cashpoint, museums,petrol stations, etc and then walk with my gps and wifi on and the app notifies me when I'm near (100-200 meters) to a cashpoint, for example.
Please help I'll put my code here...



--
Your code that plots your 'cash points' does not provide either the latitude or longitude of those points. The geocoordinates information needs to be in a List or List of Lists so the app can calculate proximity for each venue and use your distance procedure to calculate the distance between the Android and a selected venue from the List.

Your existing code cannot capture the latitude and longitude from each venue shown on the map and post all to a List.  Taifun posted a method where a developer could touch the screen and capture coordinates.  That might work in your case for capturing a single location; you would have to find his method and try it out. http://puravidaapps.com/coordinates.php  to see whether it is practical in your situation.  It would probably be extremely awkward but might work.

At present you can use your static map technique  substituting your device's current latitude and longitude for  the current LablLatadata and LablLondata text blocks and display an image.  That would visually show how close the android is to the venue (you would have to include the google   zoom factor to make that work (zoom to a high value) and would certainly be easier than calculating distance to a location for which you have no geocoordinates.

You could create your own database of the latitudes and longitudes of  ALL the venues your app needs; let the user select a venue and then you can use the latitude and longitude to calculate proximity or if you have a list of street addresses,
let Google Navigate show you how to get to the specific location. That requires maintaining what may be a huge List (duplicating what Google does with Google maps) with AI2.  

To do exactly what you want I expect you would have to use the Google Business API ( https://developers.google.com/my-business/ )  and even then it might not be impossible with AI2. You might review https://developers.google.com/my-business/content/prereqs  be aware, Google provides examples but not AI2 examples.

What you want to do with the Google supplied 'cash points' using the locations shown on the static map display if not impossible.  Perhaps someone has a simple solution. Supply your own cash points and it is relatively easy with AI2.

-- 
I checked all of your links and tried to make it work but its a big mess... 
I saw Taifuns post but I can't understand how to use the api..where should I put the html file? i put it in my phone at the directory he says but nothing works.
Also I tried to use google bussiness api but don't know how to use it with AI2 and all the tutorials are for javascripts.
Anyway I tried to make some list with coordinates already in them and another list with the names of the places but tottaly failed again. Here's a screenshot...


-- 

댓글 없음:

댓글 쓰기