1. Black Friday Sale - 50% off

    B4A Standard for $29 instead of $59!
    Buy Now
    Dismiss Notice

Android Tutorial GPS tutorial

Discussion in 'Tutorials & Examples' started by Erel, Nov 14, 2010.

Thread Status:
Not open for further replies.
  1. Erel

    Erel Administrator Staff Member Licensed User

    Are you checking it outdoors? GPS receivers mostly don't work indoors.

    @Danbicky please start a new thread for this question.
     
  2. SCIS

    SCIS Active Member Licensed User

    Managed to get it working now. Thanks, Erel!

    Really unfortunate for the poor connection indoors because there is a possibility that users also want to get their location when they're not outdoors (with the app we are designing).
    Googlemaps app itself works perfectly indoors though.

    Is there any way to get it working indoors?

    Thanks in advance!
     
  3. Erel

    Erel Administrator Staff Member Licensed User

  4. Gentry

    Gentry Member Licensed User

    What is the dataype of the GPS Location object? It apparently is not one of these types : Lists, Arrays, Maps, Strings, primitive types and user defined types, as it does not write to file when used in an list element via RandomAccessFile.WriteObject. It displays as this:

    Code:
    (ArrayList) [Location[gps 41.908098,-88.209641 acc=14 et=+1d9h1m25s31ms alt=201.0 vel=0.0 {Bundle[mParcelledData.dataSize=40]}]]
    And I am guessing that the {Bundle...} portion is a problem.

    If you needed to save a list of locations, and RandomAccessFile is not an option, is there an alternative?

    My challenge is that Location is part of a user defined datatype(UDD), and I am attempting to save a list of this UDD to file, and read it back. When the list of UDD is read back, the type of the location element is lost (all values are null), and when I try to initialize2(lat,lon) the location type element, it fails, and if I try to check if it isInitialized (as a Location) I get this error:

    Code:
    java.lang.NullPointerException: Attempt to invoke virtual method 'boolean anywheresoftware.b4a.gps.LocationWrapper.IsInitialized()' on a null object reference
    I was unable to find a new thread on this subject, and the question was posted in this thread previously, so I am attempting to ask the question in a way that is applicable to the main subject of this thread.

    Thanks,
    Gentry
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    It is always better to start a new thread.

    You will need to create custom types and convert between Location to the custom type. For further discussion please start a new thread.
     
  6. GMan

    GMan Well-Known Member Licensed User

    Hoi Erel,
    it would be really great if the link to the new thread was published here.
    Now i read 2 sides of comments and - now its broken 'cause i dont know for what to search for ,-)
    Mayba a hint for further Board-Relaeses or so...
     
  7. jchal

    jchal Active Member Licensed User

    hi all
    is it possible to convertme this example to a service runing in bacground at a spesifc interval e.g ever10 miniutes? so i can understand how it works?
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    Start with this tutorial: Service Modules

    If you need more help then please start a new thread and upload your code.
     
  9. Erel

    Erel Administrator Staff Member Licensed User

    The tutorial was updated. The GPS is now managed from the starter service and runtime permissions are used.
     
  10. Leni Berry

    Leni Berry Active Member Licensed User

    just tick runtimepermission library in library tab
     
    clurbina likes this.
  11. Declan

    Declan Active Member Licensed User

    When I try and load this example, I get the following error:
     
  12. Erel

    Erel Administrator Staff Member Licensed User

    It requires B4A v6+.

    With older versions of B4A you need to:
    1. Set the targetSdkVersion to 19 (manifest editor).
    2. Remove the RuntimePermissions and instead call:
    Code:
    CallSub(Starter, "StartGPS")
     
  13. Declan

    Declan Active Member Licensed User

    Many thanks, sorted
    As always, support is Awesome - Anywhere Software has to be the most service/support orientated supplier.
     
  14. Tayfur

    Tayfur Well-Known Member Licensed User

    @Erel ; where is RuntimePermissions or wich lib inculeded??
     
  15. Erel

    Erel Administrator Staff Member Licensed User

    RuntimePermissions is included in B4A v6.0. You will need to remove this code if you are using an older version.
     
  16. Erel

    Erel Administrator Staff Member Licensed User

    Example was updated.

    The following line should be added to the manifest editor:
    Code:
    AddManifestText(<uses-feature android:name="android.hardware.location.gps"/>)
     
    Tayfur and lemonisdead like this.
  17. Rusty

    Rusty Well-Known Member Licensed User

    I'm trying to compile the GPS example (post 1).
    I'm using B4a 6.30 and it compiles and tries to install.
    On my device (Samsung Galaxy S7), it merely states "App not installed."
    Any ideas? (My manifest has the above (post 276) line in it.)
    Thanks,
    Rusty
     
  18. Erel

    Erel Administrator Staff Member Licensed User

    Try to change the package name and run it again.
     
  19. Rusty

    Rusty Well-Known Member Licensed User

    I did. I changed it several different times with the same result.
    Any other ideas?
    All i'm trying to do is create a GPS Service. Are there other examples from which I can start?
    Thanks!
     
    Last edited: Sep 29, 2016
  20. Erel

    Erel Administrator Staff Member Licensed User

    Switching to USB debug mode instead of B4A-Bridge will give you more information about the installation error.
     
Thread Status:
Not open for further replies.
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