NativeScript / NativeScript/plugins
Using geolocation in Android Service, Location doesn't update but horizontal + verticalAccuracy increasing
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- TypeScript
- Estrellas
- 206
- Forks
- 123
- Merge medio
- 2 d 1 h
- PR fusionados (30 d)
- 1
Descripción
Happening on Android.
I have an example of using an android service. I wish to get the location when the app is minimised. Which the service itself is now working. However when i console log the location. The lng+lat is staying the same, but the horizontalAccuracy & verticalAccuracy is slowly increasing.
I have set the permissions to always allow for location.
export const CONTINUOUS_SERVICE_CLASSNAME =
"bundle";
import { CoreTypes } from "@nativescript/core";
const geolocation = require("@nativescript/geolocation");
android.app.Service.extend("bundle", {
onBind() {
return null;
},
onCreate() {
super.onCreate();
console.log("SERVICE CREATED");
if (!this.timerId) {
this.timerId = setInterval(async () => {
// console.log("PING");
let loc = await geolocation.getCurrentLocation({
desiredAccuracy: CoreTypes.Accuracy.HIGH,
maximumAge: 5000,
timeout: 20000,
});
console.log(loc);
}, 3000);
}
},
onStartCommand(intent, flags, startId) {
console.log("SERVICE STARTED");
return android.app.Service.START_REDELIVER_INTENT;
},
onDestroy() {
console.log("SERVICE DESTROYED");
super.onDestroy();
clearInterval(this.timerId);
},
});
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con el ejemplo de Android Service en el issue e inspecciona la llamada a getCurrentLocation de @nativescript/geolocation, incluidas sus opciones accuracy, maximumAge y timeout. Reproduce el comportamiento con la aplicación minimizada y compara los valores de ubicación sucesivos. Se considera completado cuando se haya establecido el comportamiento esperado de la ubicación en segundo plano y el issue tenga una solución verificada o una limitación de la plataforma documentada.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- android, typescript
- Área
- mobile-dev
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 28/100