Android Question notification when approaching to a place

Discussion in 'Android Questions' started by WhoIsShmoove, Dec 29, 2017.

  1. WhoIsShmoove

    WhoIsShmoove Active Member Licensed User

    I want a notification when approaching my marker approach to a place the marker radius is 250 meter

    Untitled-1.jpg

    The place are actually stored to place.kml and i use already Google maps v2 - GoogleMapsExtras in MapFragment and creating one monitoring geofences

    if a good soul can help me !

    it's been a week that I am on this problem that I ask questions without having an answer


    Sub MapFragment1_Ready
    Log("MapFragment1_Ready")
    gmap=MapFragment1.GetMap
    If gmap.IsInitialized Then

    Dim m1 As Marker
    m1=gmap.AddMarker(gmap.MyLocation.latitude, gmap.MyLocation.longitude, "toto")
    m1.Snippet = "this is toto"

    Dim cp As CameraPosition
    cp.Initialize(gmap.MyLocation.latitude,gmap.MyLocation.longitude, 18)
    gmap.AnimateCamera(cp)

    Dim KMLLayer1 As KMLLayer
    KMLLayer1.Initialize(gmap, File.OpenInput(File.DirAssets, "place.kml"))
    KMLLayer1.AddLayerToMap

    If KMLLayer1.HasContainers Then
    Dim Containers As List=KMLLayer1.GetContainers
    End If

    If KMLLayer1.HasPlacemarks Then
    Dim Placemarks As List=KMLLayer1.GetPlacemarks
    End If

    Else
    Log("Error initializing GoogleMap")
    ToastMessageShow("Error initializing GoogleMap", False)
    End If
    End Sub

    Sub AddGeofence
    Dim geo As Geofence
    geo.Initialize
    geo.Id = "DETECT"
    geo.Center.Initialize2(gmap.MyLocation.latitude,gmap.MyLocation.longitude)
    geo.RadiusMeters = 100
    geo.ExpirationMs = DateTime.TicksPerDay 'expire after one day
    CallSubDelayed3(GeofenceService, "AddGeofence", Me, geo)
    Wait For Geofence_Added (Success As Boolean)
    Log("Geofence added: " & Success)
    End Sub
     
    Last edited: Dec 29, 2017
  2. Peter Simpson

    Peter Simpson Expert Licensed User

    Search his forum for 'Geofence'
     
  3. WhoIsShmoove

    WhoIsShmoove Active Member Licensed User

    Hi, thank you for my first answer
    yes i use this already and all work good if i use one marker, only i want use my KML list, this is my problem. i put one pict for you understand more
     
  4. Peter Simpson

    Peter Simpson Expert Licensed User

    Hmm I see now you have added a lot more information to your original post. That's good, now people can see and read what you are attempting to achieve...
     
    WhoIsShmoove likes this.
  5. WhoIsShmoove

    WhoIsShmoove Active Member Licensed User

    I think I'm wrong it's not one monitoring geofences that i have to use to do what I want. geofences defines a perimeter of detection whereas I want to detect the marker KML close to me. I think it Google Places API for Android
     
    Last edited: Dec 29, 2017
  6. WhoIsShmoove

    WhoIsShmoove Active Member Licensed User

    It not Google Places API too, I do not really know how others do this I spent hours on the internet looking for a solution I can not find an example or tutorial. it's surely a big secret lol
     
  7. WhoIsShmoove

    WhoIsShmoove Active Member Licensed User

    I think maybe it Google Maps Roads API. I'm still looking for ways to do it.
     
  8. WhoIsShmoove

    WhoIsShmoove Active Member Licensed User

    I finally managed to achieve what I want, thank you for your support that has been precious :-(
     
  9. Erel

    Erel Administrator Staff Member Licensed User

    You should post the solution...
     
    Star-Dust likes this.
  10. WhoIsShmoove

    WhoIsShmoove Active Member Licensed User

    exemple with excel file
    2.18078, 47.08134, POI1
    2.62847, 47.20464, POI2
    2.58453, 46.99898, POI3
    etc...

    Code:
    Sub AddGeofence
        
    Dim workbook1 As ReadableWorkbook
        
    Dim moviesSheet As ReadableSheet
        workbook1.Initialize(
    File.DirAssets, "poi.xls")
        moviesSheet = workbook1.GetSheet(
    0)

        
    Dim geo As Geofence
        geo.Initialize

        
    For row = 0 To moviesSheet.RowsCount - 1
              geo.Id = moviesSheet.GetCellValue(
    2, row)
              geo.Center.Initialize2(moviesSheet.GetCellValue(
    1, row), moviesSheet.GetCellValue(0, row))
              geo.RadiusMeters = 
    150
              geo.ExpirationMs = 
    DateTime.TicksPerDay
             CallSubDelayed3(GeofenceService, 
    "AddGeofence", Me, geo)
             
    Wait For Geofence_Added (Success As Boolean)
             
    Log("Geofence added: " & Success)
        
    Next
    End Sub

    maybe not professional but it is my solution with the information that I have. the problem is that Geofences Monitoring detects the position in a radius of 150m and not in the direction of the road and a limit of 100 per device user. without support not easy to know what kind of APIs or libraries used. no one is communicating any help on this noticed

    also it works upside down the marker detects me while those who want to detect the marker
     

    Attached Files:

    Last edited: Dec 31, 2017
  11. DonManfred

    DonManfred Expert Licensed User

    Please use [CODE]code here...[/CODE] tags when posting code.

    [​IMG]
    [​IMG]
    [​IMG]
     
  12. WhoIsShmoove

    WhoIsShmoove Active Member Licensed User

    Last edited: Dec 31, 2017
    Peter Simpson likes this.
  13. Erel

    Erel Administrator Staff Member Licensed User

    Always start a new thread for a new question.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice