fmierlo / mytracks

Automatically exported from code.google.com/p/mytracks
1 stars 0 forks source link

Zephyr HRM doesn't connect when MyTracks recording is started remotely #574

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Pair, and configure MyTracks to connect to the Zephyr bluetooth heart-rate 
monitor.
2. Invoke MyTracks to start recording from another application through the 
MyTracks library.

What is the expected output? What do you see instead?
I expect MyTracks to connect to the HRM, but instead, it shows NONE.

What version of MyTracks are you using? On what version of Android? On what
phone?
MyTracks: 1.1.9
Android: 2.3.3
Phone: HTC Desire

If possible please provide a log.  Either upload here or send to mytracks-
support@google.com.
Detailed instructions can be found here:
http://code.google.com/p/mytracks/wiki/HowToReportErrors

This exception is Logged out:
09-20 15:44:17.883: ERROR/JavaBinder?(5606): java.lang.RuntimeException?: Can't 
create handler inside thread that has not called Looper.prepare() 09-20 
15:44:17.883: ERROR/JavaBinder?(5606): at android.os.Handler.<init>
(Handler.java:121) 09-20 15:44:17.883: ERROR/JavaBinder?(5606): at 
com.google.android.apps.mytracks.services.sensors.BluetoothSensorManager?$Messag
eHandler?.<init>
(BluetoothSensorManager?.java:167) 09-20 15:44:17.883: ERROR/JavaBinder?(5606): 
at 
com.google.android.apps.mytracks.services.sensors.BluetoothSensorManager?.<init>
(BluetoothSensorManager?.java:64) 09-20 15:44:17.883: ERROR/JavaBinder?(5606): 
at com.google.android.apps.mytracks.services.sensors.ZephyrSensorManager?.<init>
(ZephyrSensorManager?.java:23) 09-20 15:44:17.883: ERROR/JavaBinder?(5606): at 
com.google.android.apps.mytracks.services.sensors.SensorManagerFactory?.getSenso
rManager(SensorManagerFactory?.java:62) 09-20 15:44:17.883: 
ERROR/JavaBinder?(5606): at 
com.google.android.apps.mytracks.services.TrackRecordingService?.startNewTrack(T
rackRecordingService?.java:576) 09-20 15:44:17.883: ERROR/JavaBinder?(5606): at 
com.google.android.apps.mytracks.services.TrackRecordingService?$ServiceBinder?.
startNewTrack(TrackRecordingService?.java:1188) 09-20 15:44:17.883: 
ERROR/JavaBinder?(5606): at 
com.google.android.apps.mytracks.services.ITrackRecordingService$Stub.onTransact
(ITrackRecordingService.java:52) 09-20 15:44:17.883: ERROR/JavaBinder?(5606): 
at android.os.Binder.execTransact(Binder.java:320) 09-20 15:44:17.883: 
ERROR/JavaBinder?(5606): at dalvik.system.NativeStart?.run(Native Method) 

Please provide any additional information here:
This doesn't happen when recording is started from the user interface, only 
when recording is started from another application. The exception is thrown at 
the bluetooth sensor manager class meaning that the same error would happen for 
any other bluetooth sensor. Moreover, MyTracks doesn't seem to retry to connect 
to the HRM after this initial failed attempt.

Original issue reported on code.google.com by umranium...@gmail.com on 20 Sep 2011 at 10:01

GoogleCodeExporter commented 9 years ago
Please review my proposed fix, in this clone:
http://code.google.com/r/umraniummytracks-remote-start-zephyr-bug/

Original comment by umranium...@gmail.com on 21 Sep 2011 at 4:27

GoogleCodeExporter commented 9 years ago
The requested changes in the clone are ready to be reviewed.

Original comment by umranium...@gmail.com on 22 Sep 2011 at 5:54

GoogleCodeExporter commented 9 years ago
Change LGTM.

Original comment by sandordo...@google.com on 22 Sep 2011 at 6:27

GoogleCodeExporter commented 9 years ago
Dear Umran:

Your change looks good. I just ordered a Zephyr HxM and won't be able to test 
your change on actual device till the order arrives. Wondering if you can wait 
for a few days or you need this change merged sooner.

Also, can you give me the name of an android app that uses the MyTracks 
library? 

Thanks
Jimmy 

Original comment by jshih@google.com on 22 Sep 2011 at 9:13

GoogleCodeExporter commented 9 years ago
Dear Jimmy,

The change isn't urgent as we use our own version for testing our applications 
but we hope to see them in MyTracks eventually.  Whenever we discover any bugs, 
we fix it in our own copy first then after testing we submit the changes back 
to MyTracks. 

We actually have 2 applications that we are actively developing and make use of 
the MyTracks library:

Avocado MyTracks-to-MapMyTracks Bridge:
This application runs as a service that fetches sensor data from MyTracks, 
combines it with locations from the android location service, then uploads to 
www.MapMyTracks.com. MapMyTracks has an API which we found quite simple to use, 
allows us to send live sports data and allows others to view the data live as 
the sports session occurs. We're hoping that we could collaborate with the 
MyTracks team and get this functionality into MyTracks instead of us having to 
maintain a seperate application. In the meantime we are finding the MyTracks 
library limiting. It doesn't provide location data and we would like the same 
data that is going into the MyTracks database so that the uploaded data and 
MyTracks database is identical.

Avocado Activity Classifier:
This is our main application, which will be available in the market soon. It 
runs continuously as a service, using the accelerometer and some pattern 
matching algorithms, and detects when the user is doing various activities 
(e.g. walking, jogging, cycling), then invokes MyTracks when the activity is 
detected. We would be interested to have it as a sister application of 
MyTracks. There is a bit about it at 
http://blog.urremote.com/2011/08/avocadoac-activity-classifier.html

Previously, there was a suggestion for MyTracks to support starting and 
stopping MyTracks from third-party applications by intents 
(http://code.google.com/p/mytracks/issues/detail?id=132&q=intents&colspec=ID%20T
ype%20Component%20Status%20Priority%20Targeting%20Work%20Stars%20Owner%20Summary
), it seems there was some code prepared but nothing has been done since end of 
July. Is this still something that you're looking to have in a future version 
of MyTracks?

I've attached the MyTracks-to-MapMyTracks Bridge APK in case you wish to use it 
to test this issue with the Zephyr HXM.

Regards,
Umran.

Original comment by umranium...@gmail.com on 23 Sep 2011 at 7:07

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Umran:

I got my Zephyr HxM today. When I pulled in your changes, there are 3 heads on 
your repository. Wondering if you can merge the heads on the repository and 
clone a new one. Look forward to your change.

changeset:   857:abd69dab11f2
parent:      843:2f2945bae8c1
user:        Umran Abdulla <umranium.mytracks@gmail.com>
date:        Thu Sep 22 15:45:44 2011 +1000
summary:     changed 
MyTracks/src/com/google/android/apps/mytracks/services/sensors/BluetoothSensorMa
nager.java

changeset:   858:310c78ab0b4b
parent:      843:2f2945bae8c1
user:        Umran Abdulla <umranium.mytracks@gmail.com>
date:        Thu Sep 22 15:50:06 2011 +1000
summary:     Fix for the exception thrown when remotely starting bluetooth 
sensors.

changeset:   859:9f73d7168a86
tag:         tip
parent:      843:2f2945bae8c1
user:        Umran Abdulla <umranium.mytracks@gmail.com>
date:        Wed Sep 21 14:23:42 2011 +1000
summary:     Changes to BluetoothSensorManager to allow the class to be 
initialized from a thread, that isn't the main application thread.

Original comment by jshih@google.com on 29 Sep 2011 at 1:06

GoogleCodeExporter commented 9 years ago
Hi Umran:

Thanks for the info regarding your apps. Currently, we do not have plans to 
integrate MyTracks with MapMyTracks.

However, we are working on integrating MyTracks with Google Latitude. 
http://www.google.com/latitude. 

Also, we are planning to work on cloud-sync for MyTracks. Thus users have an 
option to sync the same MyTracks database to the cloud.

We want to allow users to export all their data and want other apps to be able 
to start and stop MyTracks. However, do not know when we can get to these 
enhancements.

Thanks
Jimmy

Original comment by jshih@google.com on 29 Sep 2011 at 1:33

GoogleCodeExporter commented 9 years ago
Hi Jimmy,

The change is in this clone: 
http://code.google.com/r/umraniummytracks-remote-start-zephyr-bug-2/

Would the integration with Latitude, or the cloud-sync option, allow an athlete 
to have live online updates of his/her location and sensor information? This 
would, in our opinion, be a great feature. Currently we use it for cycling in 
the following scenarios:

1) A coach can remotely follow the training sessions of his athletes, even if 
there are several of them in different locations.
2) In locally organized events, the fans could be at the nearest pub, watching 
the athletes' progress and stats.

Original comment by umranium...@gmail.com on 6 Oct 2011 at 4:16

GoogleCodeExporter commented 9 years ago
Hi Umran:

I merged your change to the main repository. Thanks for the fix.

The features you mentioned are all very exciting. In the coming weeks,
we plan to decide on the MyTracks cloud-sync strategy. Afterwards, we
can then decide what additional features we might want to build on top
of it. We want to keep MyTracks open source so others can contribute.

Jimmy

Original comment by jshih@google.com on 9 Oct 2011 at 10:17

GoogleCodeExporter commented 9 years ago

Original comment by jshih@google.com on 11 Oct 2011 at 5:04