I would like to write an application which can scan Bluetooth devices
around it, log their location and do periodically upload to server. To
save energy, I hope to turn off location update when there are no
Bluetooth devices detected.
My current design is use an Activity and an IntentService (which
implements location listener). In the Activity there are three
buttons, which are start tracking, stop tracking and upload. The
activity registers BTReceiver to listen for
BluetoothDevice.ACTION_FOUND. Once the start is pressed, I use a
timerTask to call startDiscovery for every minue. As for stop button,
it will cancel the timerTask. The BTReceiver will start IntentService
and pass the Bluetooth name via the intent once it receives
BluetoothDevice.ACTION_FOUND. The IntentService will register location
listener, sleep for 20 seconds (in the hope for GPS to get a latest
location) and write the Bluetooth name and location to a text file on
SD card. The upload button will read the textfile and use HTTP POST to
upload data.
However, I encounter the following problems.
1.      Program running state
How can I let users know the application is running properly? If I
check the running state of the IntentService, it is not accurate
because it only gives me whether the IntentService is running. The
timerTask may be running but there are no Bluetooth device detected.
2.      Location accuracy
If a user is riding a bike and a Bluetooth is detected, the location
written into the text file will be the location at which the user is
after 20 seconds. Is there a better design?
Besides, if there are too many Bluetooth devices detected, the
IntentService will take a long time to process them. It may cause very
inaccuracy result, is there a solution?
3.      Periodically upload
I plan to use a timerTask which runs every hour to do the upload.
However, this function will read the text file. If the tracking is in
progress, the text file will be read and written at the same time. How
do I solve this problem?
4.      Location provider
Users may turn on/off location providers during tracking. Is there a
way to detect such event?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to