NativeScript / NativeScript/plugins
Using geolocation in Android Service, Location doesn't update but horizontal + verticalAccuracy increasing
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- TypeScript
- Star
- 206
- Fork
- 123
- Merge trung bình
- 2 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 1
Mô tả
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);
},
});
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với ví dụ Android Service trong issue và kiểm tra lệnh gọi getCurrentLocation của @nativescript/geolocation, bao gồm các tùy chọn accuracy, maximumAge và timeout. Tái hiện hành vi khi ứng dụng được thu nhỏ và so sánh các giá trị vị trí liên tiếp. Được xem là hoàn tất khi hành vi định vị nền mong đợi đã được xác lập và issue có bản sửa lỗi đã được xác minh hoặc một giới hạn nền tảng được ghi lại.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- android, typescript
- Lĩnh vực
- mobile-dev
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 28/100