Is it possible to use http://www.w3.org/TR/geolocation-API/ to track location of Android
application without using android.location.Location, android.location.LocationListener,
import android.location.LocationManager classes. I hope by using geolocation API can provide
same API for all mobile platforms to get the GPS. Appreciate if you can provide an example for
geolocation-API.
How can I get my android mobile location using geolocation-API.?
There is other thread on this topic , which does identify that this API should work just fine, provided that you are defining the permissions in manifest file.
Also as the API is used in web-environment, you would need to then have the code executed in one, for example by using the webview as was with the other question.
Related
We have the next problem:
We are consulting the gps location in order to get a list that contains only those that are close in a radius, but when consulting the GPS it gives us timeout after at leat 40 seconds of waiting.
The problem especially occurs in Android with a Xiaomi Redmi 8 in industrial environments, with less connection than usual or on the move, they donĀ“t have access to LTE all the time.
We use the library # react-native-community / geolocation or navigation.position
Can you help us with any other library or strategy to obtain GPS position that does not consists in the gps wacthing changes on its position all the time? something like getting it on the background..
Code
Geolocation.getCurrentPosition(
position => {
// process the position
},
error => {
console.log(error);
}, {
timeout: 40000,
maximumAge: 0
}
);
As cited from library's github page:
Currently, on Android, this uses the android.location API. This API is not recommended by Google because it is less accurate and slower than the recommended Google Location Services API. This is something that we want to change in the near future https://github.com/react-native-community/react-native-geolocation/issues/6.
There also are some library suggestions in the readme, that actually use Google Location Services API. I've used react-native-location, but this package isn't actively maintained anymore, so I switched to react-native-geolocation-service, which has a very similar API to what you're already using, more specifically the getCurrentPosition.
Perhaps you should give it a try.
react-native-community/geolocation does not utilize the more accurate Google Location Services API, as stated in readme
The recommended library for GPS location (and the one I used) for RN Android is react-native-geolocation-service. Its Readme also mentions a timeout issue which makes me wonder if it is the same as yours:
This library is created in an attempt to fix the location timeout
issue on android with the react-native's current implementation of
Geolocation API. This library tries to solve the issue by using Google
Play Service's new FusedLocationProviderClient API, which Google
strongly recommends over android's default framework location API. It
automatically decides which provider to use based on your request
configuration and also prompts you to change the location mode if it
doesn't satisfy your current request configuration.
So if I were you I would give it a go. The API is meant to be a drop-in replacement for the library you used so migrating should be just a matter of changing packages.
I tried decompiling an app posted on the playstore and the app has this code:
import android.location.ILocationManager
I cant replicate this on my app I get the error cannot resolve symbol. The app i'm looking at can be installed as a system app for some functions to work. Maybe this has something to do with it being a system app?
How can I get the ILocationManager class?
Late reply, but ILocationManager isn't actually a class, it's an interface. Therefore you can't instantiate it. The interface definition isn't in the android sources, but Google Sources has a version of it: ILocationManager.aidl
You can read about Android Interface Definition Language (AIDL) here.
Classes using the ILocationManager are among others Geocoder and LocationManager - have a look at them. It is used for communicating with a service on the Internet; in the case of Geocoder, to communicate with the google geocoder service.
I am trying to fetch events from Google Calendar(Online) using Google Calendar API's in Android application but can't find what library need to import in my Android project. Provide link to import exact library to import in my Android application project.
You can use Google Calendar API directly importing to your project. By using that you can create, view, edit and delete any activity.
For more info see this following page.
https://developers.google.com/google-apps/calendar/
u can either use rest,client libraries to access google calendar api's ... client api will be size overhead .. so better use rest calls ... here is the link which explains rest calls and json parsing ...http://www.androidhive.info/2012/01/android-json-parsing-tutorial/
I am working on the developement of an android app. I need to locate the user without displaying the map (only the name of his location ei New york, USA)
I work using Eclipse SDK.
Is there a way to do it?
Thanks :)
Ps: I am new to android
Android API Maps
In the API documentation it shows you step by step how to get started on this
type of application.
How to get started
One thing you have to remember is that the user must enable
the GPS to get current location
Since you explained in comments that you already know how to get the Location, and thus the latitude and longitude, you can resolve it to an address using Android's GeoCoder class, with its getFromLocation(double,double,int) method.
I go through 2 different Google Calendar code samples. After finished reading them, I am getting confused.
https://developers.google.com/google-apps/calendar/instantiate
They are using oAuth2?
They are using scope https://www.googleapis.com/auth/calendar. Is it because they are using oAuth2?
They required 2 API keys, clientId and clientSecret. Is it because they are using oAuth2?
They are using com.google.api.services.calendar.Calendar.
http://code.google.com/p/google-api-java-client/source/browse/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/CalendarSample.java?repo=samples
They are using ClientLogin?
The scope is cl? Is it because they are using ClientLogin?
They only require 1 simple API access key. Is it because they are using ClientLogin?
They are using com.google.api.services.calendar.model.Calendar. What is the difference with com.google.api.services.calendar.Calendar?
My target platform is on Android. Should I be using method from 1st example, or 2nd example?
The second example is using Android functionality of AccountManager which can access stored account information on an Android device. The AccountManager class will do the OAuth in the background, so that the developer doesn't need to. See previous question.