2015-09-04 11 views
5

AからBへ移動するときにユーザーの旅(経路)を保存するアプリケーションを実現する必要があります。今、ionicframeworkはGPSを使用できることがわかりますが、私のAPPはバックグラウンドに行く?私のアプリはどのようにしてユーザーの位置を保存し続けるのですか?これは可能ですか?私が使用できるプラグインが(600ドル以上はありません)ありますか?モバイルアプリケーションがバックグラウンド(イオンフレームワーク)のときのGPS位置

+0

http://stackoverflow.com/questions/32386231/navigator-geolocation-getcurrentposition-when-screen-is-locked –

+0

の重複いいえ、これは重複しているわけではありません。他の回答はプレミアムプラグインを参照しています。@ZioBuddaは言及していました。 – Gajotres

答えて

3

プラグインを使用すると$ 600 +プレミアムプラグインと呼ばれる可能性があります。

人々は通常、古いバージョンが最後の生のAndroid/iOSのバージョンを含む、も利用可能であることを忘れて:https://github.com/christocracy/cordova-plugin-background-geolocation/tree/0.3.7

ionic plugin add [email protected] 

現在、他の異なるバージョンが存在しない、他のすべては、このオリジナルのプラグインだけのフォークです。

+0

私はあなたの提供するプラグインを背景ジオロケーションに使用しようとしています。しかし、私は、 "バックグラウンドジオロケーション:無効なライセンス"として通知のフラッシュを取得しています。あなたはそれを修正するために私を助けてくれますか?私のスクリプトに関する詳細が必要な場合は教えてください。前もって感謝します。 –

9

私はちょうど、イオスとアンドロイドのための新しいcordozバックグラウンドジオロケーションプラグインを書き終えました。その無料で簡単です!それを試してみる:

https://github.com/pmwisdom/cordova-background-geolocation-services

イオンの使用法:

//Wait for cordova/ionic ready to use the plugin 
ionic.Platform.ready(function(){ 
    //Make sure to get at least one GPS coordinate in the foreground before starting background services 
    navigator.geolocation.getCurrentPosition(); 

    //1. Get plugin 
    var bgLocationServices = window.plugins.backgroundLocationServices; 

    //2. Configure Plugin 
    bgLocationServices.configure({ 
     desiredAccuracy: 20, 
     distanceFilter: 5, 
     notificationTitle: 'BG Plugin', 
     notificationText: 'Tracking', 
     debug: true, 
     interval: 9000, 
     fastestInterval: 5000 
    }); 

    //3. Register a callback for location updates, this is where location objects will be sent in the background 
    bgLocationServices.registerForLocationUpdates(function(location) { 
     console.log("We got a BG Update" + JSON.stringify(location)); 
    }, function(err) { 
     console.log("Error: Didn't get an update", err); 
    }); 

    //4. Start the Background Tracker. When you enter the background tracking will start, and stop when you enter the foreground. 
    bgLocationServices.start(); 


    ///later, to stop 
    bgLocationServices.stop(); 

}); 
+0

サンプルの使用方法をここに含めてください。 – Teepeemm

+0

どのようなサンプル使用法が好きですか? github repoは使用方法の詳細を示します。 – Mirrorcell

+0

Gotcha、私はいくつかの情報で更新します。 – Mirrorcell

関連する問題