B4A Library LocationManagerEx library

Discussion in 'Additional libraries, classes and official updates' started by icefairy333, Oct 1, 2012.

  1. icefairy333

    icefairy333 Active Member Licensed User

    demo:
    Code:
    'Activity module
     Sub Process_Globals
        
    'These global variables will be declared once when the application starts.
        'These variables can be accessed from all modules.
     
     
    End Sub
     
     
    Sub Globals
        
    'These global variables will be redeclared each time the activity is created.
        'These variables can only be accessed from this module.
     Dim lmex As LocationManagerEx
        
    Dim btnGeoSet As Button
        
    Dim edthb As EditText
        
    Dim edtjd As EditText
        
    Dim edtwd As EditText
     
    End Sub
     
     
    Sub Activity_Create(FirstTime As Boolean)
     Activity.LoadLayout(
    "1")
     lmex.Initialize(
    "lm")
     
    End Sub
     
    Sub lm_locationchanged(locArg As Location)
        
    Log(locArg.altitude)'海拔
        Log(locArg.Longitude)'经度
        Log(locArg.Latitude)'纬度
     End Sub
     
    Sub Activity_Resume
     
     
    End Sub
     
     
    Sub Activity_Pause (UserClosed As Boolean)
     
     
    End Sub
     
     
     
     
    Sub btnGeoSet_Click
        
    Dim l As Location
        l.Initialize
        l.Altitude=edthb.Text
        l.Longitude=edtjd.Text
        l.Latitude=edtwd.Text
        lmex.GeoSet(l.Latitude,l.Longitude,l.Altitude)
     
    End Sub
    outputlog
    ;)
     

    Attached Files:

  2. warwound

    warwound Expert Licensed User

    Have you seen my xml2bb script?
    It makes easy work of creating library documentation from a library's xml file:

    Author: IceFairy333
    Version: 1.1
    • Location
      Methods:
      • BearingTo (TargetLocation As Location) As Float
      • ConvertToMinutes (Coordinate As Double) As String
      • ConvertToSeconds (Coordinate As Double) As String
      • DistanceTo (TargetLocation As Location) As Float
      • Initialize
      • Initialize2 (Latitude As String, Longitude As String)
      • IsInitialized As Boolean
      Properties:
      • Accuracy As Float
      • AccuracyValid As Boolean [read only]
      • Altitude As Double
      • AltitudeValid As Boolean [read only]
      • Bearing As Float
      • BearingValid As Boolean [read only]
      • Latitude As Double
      • Longitude As Double
      • Speed As Float
      • SpeedValid As Boolean [read only]
      • Time As Long
    • LocationManagerEx
      Events:
      • locationchanged (locArg as Location As )
      • providerdisabled (providerStr as strin As )
      • providerenabled (providerStr as strin As )
      • statuschanged (providerStr as string As , statusflag as in As )
      Methods:
      • GeoSet (latitude As Double, longitude As Double, altitude As Double)
      • Initialize (EventName As String)
      • requestGPSLocation
      • requestMobileLocation
      • stopGPSListening
      • stopMobileListening
      Permissions:
      • android.permission.ACCESS_COARSE_LOCATION
      • android.permission.ACCESS_FINE_LOCATION
      • android.permission.ACCESS_MOCK_LOCATION
      • android.permission.INTERNET

    I'll have a play with your library later.

    Thanks.

    Martin.
     
    Last edited: Oct 14, 2012
  3. Informatix

    Informatix Expert Licensed User

    Cool !
     
  4. warwound

    warwound Expert Licensed User

    I just noticed it failing on a couple of bits of XML.
    I'll get them fixed!

    Martin.
     
  5. icefairy333

    icefairy333 Active Member Licensed User

    very good!
     
  6. fabio borges

    fabio borges Member Licensed User

    Hi,

    Could you include requestLocationUpdates (String provider, long minTime, float minDistance, LocationListener listener) method in your lib?

    Thanks,

    Fabio
     
  7. Dadeda

    Dadeda Member Licensed User

    how can i get the lat/long coordinates without using gps? only from wifi or 3g connection with your lib ?
     
  8. ddahan

    ddahan Member Licensed User

Share This Page

Loading...