Problem Example Geolocation error Permissions Android Not answered

Hi George,

I saw this same topic, without answer…

I I had not noticed, because I use iphone, but for a few months I started receiving complaints from users who use android saying the app does not read the coordinates.
That happened a month or two ago.
I changed it to cli 7.0.1, 8.0.0
I put different versions

' ''

Finally I decided to start from scratch and take the geolocation example from appstudio

If you do not put the plugin nor the version of the phonegap cli, it displays a message of lack of access to geolocation.

If you put the plugin, it shows the location icon but the error, timeout expired.

iOS works ok, but android is unviable.

I tried with App studio 6.x and 7.x, using the geolocation example.

Try compiling and using an android, it’s impossible.

I searched a lot on google and did not find the answer.

I accept suggestions

Regards
Vagner

Is this under PhoneGap?

Yes in Phonegap i tried 6.5.0 7.1.0 8.0.0

OK, Issue has been moved to PhoneGap.

Have you connected the Chrome Remote Debugger to see if there are any error messages?

George, i tried in Debugging, same problem, see it below

OK, I will set up a test here. It may take a couple of days - we are backed up here. What version of Android are you using?

I´m testing in Android 5, 6 and 7
Couple days is cool,
I’m suffering already a week ago, looking for a solution on google …

If you’re running under PhoneGap, you need to use the plugin. Do you have these lines in your configxml?

<plugin name="cordova-plugin-geolocation" source="npm" />
<edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
    <string>need location access to find things nearby</string>
</edit-config>

I am using this
NSLocationWhenInUseUsageDescription

but works only in iOS, i will try again

Follow config.xml lines

need location access to find things nearby

with cli 6.5.0 , have no permission to geolocation
with cli 7.1.0 timeout expired.
Let me attach the projectGeolocation.zip (48.5 KB)

Hi George, some news?

Have you tried cli-8.0.0? I use that for all projects now.

yes, i did with cli-8.0.0
just a detail… i still using appstudio 6.3.1.2

Is it too easy to test it, did you try use the sample, compile and try it in your device?
This is getting critical to me.

This seems to be a problem with the use of PhoneGap - not an AppStudio issue. We’re not experts at PhoneGap (it’s not our product), so it doesn’t fall under our free support policy:

https://www.nsbasic.com/app/support.php/

This is NOT a PGB issue. This is a chromium issue.

You also don’t need to add in all that crap the AppStudioSupport told you add in. Just follow the directions on the plugin git and it will automatically create the permissions in the info.plist.

    <plugin name="cordova-plugin-geolocation" spec="4.0.1">
        <variable name="GEOLOCATION_USAGE_DESCRIPTION" value="App uses geolocation to determine where you are." />
    </plugin>

Next. you need to know that the geolocation plugin no longer accesses the geolocation hardware like it used to and like native apps do, instead it uses the geolocation built into the chromium webview.

If you leave your android phone on your desk, you’ll get lots of timeouts… after the initialization, that’s pretty much all you will get. If you get up and move around, you get fewer of them.

Essentially the timeout is saying “we were unable to obtain a geolocation different from the last one we gave you within the time limit you specified in your timeout value.”

There are a few things you can do… specifically, try the following:

    watchID = navigator.geolocation.watchPosition(success, failure, {maximumAge: 1000, timeout: 15000, enableHighAccuracy: true });

FWIW, the whole chromium geolocation is really a complete crock of crap and the android people should be fired for this!

PPetree - Thanks for posting this! Looks like you’ve suffered from this same issue.

It looks reasonable - I’m looking forward to seeing if it works!

Guys, i did nothing and works again… i hate phonegap!!!

I do too!

I’m thinking of moving to flutter.

Hi Guys,

I am testing the geolocation sample app on android and have replaced the html widget with the google maps.
I have created my api and added.
I add my current location manually
All is well if I run in the browser I see the map of my location.

A couple of issues.

  1. The app did not ask for any permissions so I added to the config file. This forces the allow GPS permission.
  2. When run on Android the map widget shows but with no location imagery ( Sorry, we have no imagery here) When I hit start the coordinates show in the Text Area widgetas expected but the map does not change.
function ShowMap(latitude, longitude) {
    //This function displays a Google map.
    //only update the map every 10 seconds.
    //For information on the Google Static Maps API, go here:
    //http://code.google.com/apis/maps/documentation/staticmaps/
    if(SysInfo(10)-lastRefresh<10000 )  { return; }
    lastRefresh=SysInfo(10);
   GoogleMap1.mapOptions.latitude = latitude;
   GoogleMap1.mapOptions.longitude = longitude;
   GoogleMap1.refresh();
   console.log(s);
}

What am I missing here please.

Cheers

Steve Warby