0

私はAndroidに非常に慣れていないことに注意してください。

位置検出を制限するなどしてバッテリー寿命を節約する方法を研究しようとしています...これを行うには、複数の位置情報ベースのアプリケーションの位置検出を「ピギーバック」したいと考えています。私が達成したいのは、複数のそのようなアプリケーションをシミュレートすることです。それぞれに独自の LocationListener (アプリケーションコンテキストから来る LocationManager) があり、単一のアクティビティからオブジェクトをインスタンス化するかのように新しいアプリケーションを生成したいと考えています。ここで重要なことは、多数の異なるアプリケーション コンテキストを配列またはリストに格納できるようにすることです。

つまり、要するに、次の行に沿って何かを行う方法です。

Vector<Application> applications = new Vector<Application>();

applications.add( new Application() );
applications.add( new Application() );

// here new Application would only be an object which extends Application

など...もちろん、アプリケーションはアクティビティまたはサービスになる可能性があります...その方法がわからないので、それぞれのLocationManagerを介して位置センシングを個別に、互いに独立して実行できます。

ありがとう、気をつけて!:)

敬具、ピョートル。

================================================== ============================

編集:

したがって、バッテリー寿命を節約するための次のことは冗長ですか?:

「以下の 6 つのシナリオのうち。簡単にするために、{(Maintained states), Incoming state} の表記を使用して、各シナリオを示します。(t、T0、D0) を使用して、着信要求を示します。ここで、t は時間です。 T0 は要求された更新時間間隔であり、D0 は要求された距離間隔です. 維持された状態の場合、(Gps, T1, D1) を使用して Gps 状態を示します。 (Net, T2, D2) を使用して、T2 である最小の時間間隔と D2 である最小の距離間隔でネット状態を示します。」

• {(Gps), Gps}: The prototype checks whether the (Gps, T1, D1)
state is valid. If so, then it compares (T1, D1) to (T0, D0). If
T1 < T0 and D1 < D0, then piggybacking is enabled, and the
piggybacking time is calculated.
• {(Gps), Net}: As Net typically has coarser location information
than Gps, the operations are similar to the ({Gps},Gps) scenario,
but the comparison is between (T2, D2) and (T0, D0).
• {(Net), Net}: Similar to {(Gps), Gps} case by replacing Gps
with Net.
• {(Net), Gps}: Since Gps is typically finer than Net, the request
cannot piggyback on existing Net registrations. The new registration is passed through                 immediately.
• {(Gps, Net), Gps}: Similar to {(Gps), Gps}.
• {(Gps,Net), Net}: The prototype firstly checks the Net state,
which is similar to that of {(Net), Net}. If not possible to piggyback, then it checks the     Gps     state, which is similar to {(Gps),
Net} scenario.

疑似コード:

(c) Sensing Piggybacking (SP)
Variables
StateGps: Gps registration state
StateNet: Net registration state
time: Requested location sensing frequency
dist: Requested location sensing distance
1 Received requestLocationUpdate(provider, time, dist,...)
2 Store information about provider, time, distance
3 Check validity of StateGps and StateNet
4 If provider == Gps
5 Compare StateGps to time and dist
6 If StateGps allows piggybacking
7 Delays the registration to enable piggybacking
8 End
9 Else // provider == Net
10 Compare StateNet to time and dist
11 If StateNet allows piggybacking
12 Delays the registration to enable piggybacking
13 Else
14 Compare StateGps to time and dist
15 If StateGps allows piggybacking
16 Delays the registration to enable piggybacking
17 End
18 End
19 End

これが冗長でない場合、どのように実装するのでしょうか? :)

もう一度、ありがとう!

4

2 に答える 2

0

これを行うには、複数の位置情報ベースのアプリケーションの位置検出を「ピギーバック」したいと考えています。

これは、「ピギーバック」の従来の定義に対して、ハードウェアと OS によって自動的に行われます。

100 個のアプリが同時に GPS の修正を要求している場合、ハードウェアが自発的に 100 個の GPS 無線を拡張することはありません。(多くても) 1 つのGPS ラジオがあり、1 つの量の電力を消費し、それらを要求している現在のアプリに位置情報の修正を提供します。

ここで重要なことは、多数の異なるアプリケーション コンテキストを配列またはリストに格納できるようにすることです。

それは不可能です。

于 2013-06-30T12:48:36.063 に答える