Android: Reverse Geocoding not working - android

Apparently, I can get the latitude and longitude but when I this part of code below for Reverse Geocoding it shows as "Service not available". What does it mean? I have added user permisions for INTERNET, FINE and COARSE location in the Android manifest file. Am I missing something ?

this comes when you are running your app on emulator, try running on actual device. I think it will work properly on device.

Related

Is there any solution for getting location in android emulator flutter

I'm using geolocator package for the purpose of device current location when I'm using my app in my real device that's perfectly run and returning back the exact long and lang when I'm using the same app in android emulator nothing is returning how I can resolve this issue?
The default location in Android Emulator is Googleplex, Mountain View (US). You cannot track Emulator location but can simulate it. An example how to do it here
The only thing that worked for me, was changing the location and then going into Google Maps on the emulator, enable location there and wait for it to jump from the Googleplex location, to the custom location. Then I restarted my app, and it returned the correct location.

Android Google maps api not loading on my app

The error message is:
Network error. Please try again later.
Any idea why it's possibly not loading on my phone. Everything seems to be updated and good.
Assuming your device has a network connection, I would assume it's because you don't have the android.permission.INTERNET permission declared in your manifest.

geolocation.watchposition not working with network based location off

I am building a location aware app for Android using sencha 2.3.1 + phonegap 3.3.0, and use geolocation to show a list of destinations ordered by proximity to the user location.
Everything works fine if the setting for network-based location is on. But if I turn it off and leave gps only based location then it never gets detected.
The code is very basic, I tried both the sencha path:
Ext.device.Geolocation.watchPosition({
frequency: 10000,
callback: function(position) {
AppHelper.setCurrentLocation(position);//yeah!!
},
failure: function() {
AppHelper.setLocationModeOff();//oouch!
}
});
and the phonegap path:
var success = function(position) {
AppHelper.setCurrentLocation(position);
};
var fail = function() {
AppHelper.setLocationModeOff();
};
navigator.geolocation.watchPosition(success, fail,{ timeout: 30000 });
Result is the same, I tried waiting for a couple minutes for the geolock to happen but no sign of location service.
The phonegap location plugin is installed, the permissions are correct, and everything works if network location is enabled.
I am testing on a Sony Tablet S.
I am aware of this bug:
How to get user position by GPS in Sencha
But I checked the code and its is definetely fixed in sencha 2.3.1
I wil try on other devices but I was wondering if anybody experienced the same.
TIA.
EDIT:
I made an experiment using standard html5 code on my android device using systems default browser (webkit based).
I would access my settings page and change settings at each run.
Accessing http://html5demos.com/geo I get the following:
I started the device with network geolocation on and gps based location off:
I get a message that asks if I want to share my location I say yes, only this time everything works fine.
Turn off network based geolocation, gps still off:
Location detection fails. (as expected)
Turn on GPS, leave network geolocation off:
Geolocation fails silently, I don't get a request to use my location and subsequent activation of GPS based gelocation.
So my conclusion is: this is similar to what I noticed in phonegap. If network based geolocation is on everything works as expected. But if I have no network connection and gps is on that is pretty useless in my html5 app.
At least this is what happens on my device (sony tablet)
From my understanding of HTML5 geolocation API, that is expected behaviour, you just can't control if under the hood it is using gps or network location.
What's probably happening is that watchPosition(), when it is called, tries first a raw, quick positioning using network, then goes with the gps positioning to give you a better result (assuming you called it with the enableHighAccuracy parameter).
If you are disabling network positioning it probably gets stuck at the first point: as stated in cordova/phonegap's docs the permission to access coarse location is a requirement for geolocation to work.
(in app/AndroidManifest.xml)
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
I am guessing that revoking access to coarse location from the device settings somehow "overrides" the user permission given when installing the app.

When I try to send a location update to the emulator I get an error message

When I am in the emulator control view in the DDMS I am attempting to send a Mock Location to my emulator. However when I try this I get the following error message, "Unable to send command to the emulator". I cannot understand why this is not working as it was fine yesterday and I havent made any changes to my application. Please help?
I was facing same problem. After restarting process of adb.exe from task manager it worked.
If you use mobile device for checking results, I think in your code, you would have mentioned the NETWORK_PROVIDER in location manager. If it is, then change it to GPS_PROVIDER and dont forget to add the permissions in your manifest file(android.permission.ACCESS_FINE_LOCATION). And now send the command through emulator control. it will work.

Spoof or fake location on Android phone

I've been trying to get this to work for a few days without success. Basically, I'm writing a small test app to make the phone report it's position as somewhere else using addTestProvider and setTestProviderLocation etc. Basically it looks fine and appears to report its location as having changed, however Google Maps etc. seems to still be querying the real GPS provider. Does anyone have any ideas how to get around this?
This isn't an app that will actually be used for anything, it's just really to satisfy my own curiosity and gain an understanding.
Thanks in advance.
You need to first allow your application to use Mock locations by adding the following to the manifest xml:
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>
On your phone, ensure 'Mock Locations' are enabled by selecting the “Allow mock locations” option under the Settings -> Applications -> Development menu.
And then use a mock location provider to give fake locations (e.g. by reading data off a file/db)
Alternatively you can telnet into your phone and mock the location (again you need permission and mock locations enabled on your phone):
$ telnet localhost 5554
Android Console: type 'help' for a list of commands
OK
geo fix -82.411629 28.054553
OK

Categories

Resources