Share My Creation GPS Example

Roger Daley

Well-Known Member
Licensed User
Longtime User
Sorry Klaus,

Same problem. Debug screen print attached.
It appears that even with GPS1 is enabled, with no GPS signal penetrating to my study there is no data in vals(9).

Regards Roger

PS It works fine if I go outside.

 

klaus

Expert
Licensed User
Longtime User
Unfortunately, I hadn't tested it.
Use this code instead:
B4X:
Sub GPS1_NMEA (TimeStamp As Long, Sentence As String)
    If Sentence.SubString2(0, 6) = "$GPGGA" Then
        Dim vals() As String
        vals = Regex.Split(",", Sentence)
        If IsNumber(vals(9)) Then
            GPSAltitudeSeaLevel = vals(9)
        End If
    End If
End Sub
 

willk

Member
Licensed User
Hi Klaus,

Thank you very much for this example of GPS.
I have a problem where it compling :
<<
AAPT path: C:\Program Files\Android\android-sdk\tools\..\build-tools\21.0.0\aapt.exe
Exit code:-1073741819 >>

Can you help me ?

Thank you

William (French)
 

klaus

Expert
Licensed User
Longtime User
Do you get any error when you compile ?
If yes, can you send the full error message from the Logs ?
What Android versions have you installed ?
Habe you installed the Android SDK Build-tools for your version of Android ?

Est-ce que tu recois un message d'erreur ?
Si oui, peux-tu envoyer le message complet dans le Log.
Quelles versions d'Android as-tu installé ?
Est-ce que tu as installé Android SDK Build-tools pour ta version d'Android ?

 

Attachments

  • upload_2016-8-4_9-19-56.png
    26.5 KB · Views: 473

willk

Member
Licensed User

Bonjour Klaus,

merci pour ta réponse si rapide.
Le message que j'ai posté comportait une erreur à la compilation due à un programme non trouvé dans l'arborescence d'Android SDK.
Ce message est indiqué dans le message que j'ai posté hier.

Pour ma part, j'ai téléchargé et réinstallé Android SDK et je n'ai plus d'erreur.

Merci encore et bravo pour cette belle application.

William.
 

willk

Member
Licensed User

Message d'erreur à la compilation :
<<AAPT path: C:\Program Files\Android\android-sdk\tools\..\build-tools\21.0.0\aapt.exe
Exit code:-1073741819>>
 

Rusty

Well-Known Member
Licensed User
Longtime User
Hi Klaus,
I'm trying to compile your GPSExample onto my Samsung S7 device.
I'm getting the following error:
Failure [INSTALL_FAILED_CONTAINER_ERROR]
Any advice on what might be causing this?
Thanks,
Rusty
 

klaus

Expert
Licensed User
Longtime User
I just retried the version from the forum and it works on my Samsung Galaxy S6.

DO you have an older version on the device?
If yes, uninstall it and reinstall it.

Did you test it in release mode?
Do you get an error message in the Logs when running in Debug mode?

Have you tried to put a break point at the beginning of the code and go through the program step by step?
 

Rusty

Well-Known Member
Licensed User
Longtime User
Hi Klaus,
It compiles but won't load in Debug, Release or Release Obfuscated. In all cases I get:


So it is not possible to put a breakpoint within.
I've checked for a previously installed or similar named app and none exist.
It DOES install and run on my Asus 10" tablet running 4.4.2 Kitkat

Can this be a manifest issue or SDK?
BTW my S7 is running 6.0.1 Marshmallow

Rusty
 

Rusty

Well-Known Member
Licensed User
Longtime User
Thanks to both of you
(sorry for the image post, Erel)
I re-installed the Android SDK and no difference, same error.
I then changed the #CanInstallToExternalStorage to False and it worked!
Thanks for the help.
Regards,
Rusty
 

JMW

Member
Licensed User
Longtime User
I am trying to install this on my phone and am getting an error:
B4X:
** Activity (main) Create, isFirst = true **
Error occurred on line: 12 (GPSModule)
java.nio.BufferUnderflowException
    at java.nio.DirectByteBuffer.getInt(DirectByteBuffer.java:230)
    at anywheresoftware.b4a.randomaccessfile.RandomAccessFile.ReadInt(RandomAccessFile.java:137)
    at anywheresoftware.b4a.randomaccessfile.RandomAccessFile.readHelper(RandomAccessFile.java:406)
    at anywheresoftware.b4a.randomaccessfile.RandomAccessFile.ReadObject(RandomAccessFile.java:395)
    at B4A.GPSExample.gpsmodule._loadpath(gpsmodule.java:41)
    at B4A.GPSExample.main._activity_create(main.java:710)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:708)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:340)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
    at B4A.GPSExample.main.afterFirstLayout(main.java:102)
    at B4A.GPSExample.main.access$000(main.java:17)
    at B4A.GPSExample.main$WaitForLayout.run(main.java:80)
    at android.os.Handler.handleCallback(Handler.java:746)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5443)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
** Activity (main) Resume **
Just learning B4A.
 

klaus

Expert
Licensed User
Longtime User
In the Files folder of the project replace:
B4X:
If File.Exists(File.DirAssets,"Test1.GPP") Then
    File.Copy(File.DirAssets, "Test1.GPP", GPSDir,"Test1.GPP")
End If
If File.Exists(File.DirAssets,"Test2.GPP") Then
    File.Copy(File.DirAssets, "Test2.GPP", GPSDir,"Test2.GPP")
End If

by
B4X:
If File.Exists(File.DirAssets,"test1.gpp") Then
    File.Copy(File.DirAssets, "test1.gpp", GPSDir,"test1.gpp")
End If
If File.Exists(File.DirAssets,"test2.gpp") Then
    File.Copy(File.DirAssets, "test2.gpp", GPSDir,"test2.gpp")
End If
Attached a new version.
 

Attachments

  • GPSExampleV2_4.zip
    133.7 KB · Views: 588

JMW

Member
Licensed User
Longtime User
Thank you Klaus. That fixed it, and I learned something important.
 

Similar Threads

  • Question
Android Question GPS location
Replies
1
Views
1K
Replies
5
Views
1K
Replies
5
Views
1K
Replies
1
Views
2K
Cookies are required to use this site. You must accept them to continue using the site. Learn more…