Can not get latitude and longitude from location sensor

I am making an app that is supposed to tell users if there is a certain problem in the street by getting information from previous users about certain problem and its details and in order to do that i trying to get the user reporting a problem current location, latitude, and longitude.
At first I tried to save the current address, latitude, and longitude the them to tiny db as they are however when I tried it did not get my latitude and longitude , after that I saw a similar problem here and someone advised him to first set the longitude and latitude as texts then save them to tiny db, however when I tried it, it also did not get my latitude and longitude.
1
2

Welcome Jowiria.

You unfortunately have lots of issues Jowiria.

You can fix them one at a time a nd get your Project working. :slight_smile:

Not your latitude and longitude? What latitude and longitude were reported? Possibly 0,0 ? When you save_btn, have you waited long enough to get a satellite fix (LocationChanged event)?

Where are your TinyDB1.GetValue Blocks.
getValue

Those Blocks are needed to retrieve what you sent to the TinyDB on each of the Screens you want to work with them. A TinyDB1 control needs to be placed on each of your Screens (can be avoided if you use virtual screens) and the TinyDB values assigned to a variable on your saveScreen and posted to a Label or something in order for you to 'see' the captured values.

Have you read this tutorial Using the Location Sensor and tested the two aia examples? When you do that, can you see your latitude and longitude in the example apps?

I have placed the tiny db get value blocks in the screen I want to retrieve these values, however when I tried it did not even report any latitude or longitude at all.

I have read the toturial it was pretty useful but not it did not help much with my problem and I tried to download the aia examples but it was considered unsecure by the browser I am using and refused to download both files.

...and what additional code did you use so that you can post the results of the GetValue tags to a Label? Post an image of your additional blocks; even post your aia if you like.

I ask again about what you see versus what you do not see.

Most developers download these files with no issues. You can try again to get an example of a basic way to use the LocationSensor as described below or by possibly using a different Browser, perhaps Chrome.

Here is a different testing app you could try. When you get it, run the program and let me know what you see on the display. You can test gps, passive and network.

SimpleGPSTester.aia (6.9 KB)

  • What Android version are you using (knowing which operating system might affect any specific recommendations).
  • Until you get and provide some indication that your LocationSensor is working properly, you cannot determine what is being stored.

After I corrected a certain code what I saw was 0,0.
I am using android 11

3
this is in another page called savescreen

What you see is the default location coordinates that display prior to achieving a satellite fix and prior to a LocationChanged event. Are you testing indoors..get outside or near a window perhaps.

Here is an example storing an address from the LocationSensor to a TinyDB

Android11GPSsave.aia (3.0 KB)

that might work for you. If it does, use it as a model for your app. :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.