NativeScript / NativeScript/plugins

Using geolocation in Android Service, Location doesn't update but horizontal + verticalAccuracy increasing

オープン
#308 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
TypeScript
スター
206
フォーク
123
平均マージ
2日 1時間
マージ済み PR(30日)
1

説明

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);
  },
});

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Issue の Android Service の例から始め、accuracy、maximumAge、timeout オプションを含む @nativescript/geolocation の getCurrentLocation 呼び出しを調査します。アプリを最小化した状態で動作を再現し、連続する位置情報の値を比較します。バックグラウンドでの位置情報に期待される動作が確立され、issue に検証済みの修正または文書化されたプラットフォームの制限があることを確認できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
android, typescript
領域
mobile-dev
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
28/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。