Geographic Position Problem in Android

Hi Friends.

I have a problem about using positioning feature in android. My app requests position info for submitting an entry. But if “phone only” location mode is selected on the phone (which is the default option) my app throws that "we ran into a bug: error.
Its working nice If “high accuracy” tracking mode is selected. But this mode needs an agreement to be accepted which makes average user go mistrustful and is hard to discover. (I spend 1 hour to find out the selected mode is the problem).

As a result, I want to be able to use current position with the default phone only gps tracking mode on Android phones. What do you suggest about this issue?

Thank you.

Can I have one

I’ll share my solution for anyone who faces the same issue.

I handled this problem with a couple of JS lines.

First, install the toolbox plugin.
Draw two “javascript to bubble” elements to your page.
Name them as latitude and longtitude.

Then in the editor;
place Run Javacript action where you want and put the following code:
(caution: if you use it for a button click event, it will store the value and use it for the next click. So you have to store somewhere else before the button click.)

navigator.geolocation.getCurrentPosition(function(position) {
lat = position.coords.latitude;
lng = position.coords.longitude;
bubble_fn_latitude(lat);
bubble_fn_longtitude(lng);
});

Since the geolocation API(you dont need to connect that, its already there) used in this code get only coordinates, it will work if gps only mode selected on the phone.

1 Like