2

I wonder if others have experienced this as well. when attaching to the Sensor.TYPE_MAGNETIC_FIELD sensor on a Moto 360 (Android Wear), I'm not getting any updates.

the following code all works:

SensorManager sm = (SensorManager) this.getSystemService(Context.SENSOR_SERVICE);
Sensor magnetic = sm.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
Log.i("Wear", "magnetic: " + magnetic);

with the output:

I/Wear    (17471): magnetic: {Sensor name="Compass Sensor", vendor="Motorola", version=1, type=2, maxRange=4900.0, resolution=0.15, power=0.45, minDelay=40000}

but after registering a listener to this sensor, no events are ever fired.

other sensors (like the accelerometer and the gyro) work fine.

Ákos Maróy
  • 919
  • 2
  • 10
  • 19

4 Answers4

0

can you try shaking the device a bit and see if the compass readings show up. Also can you try to move it to another area (with less magnetic interference) .. and maybe do some figure eights to calibrate the device.

SID
  • 1
  • 1
  • Can you explain why this would help? – emsworth Oct 06 '14 at 14:53
  • I've tried all of the above (and more, like using TYPE_MAGNETIC_FIELD_UNCALIBRATED), but nothing seems to "wake up" the compass. Is it possible that it's disabled in the firmware? – cjm Oct 13 '14 at 19:43
0

I suspect that it's a larger problem than just the 360. I just received the LG Watch R and the compass doesn't work. There is one stock watch face that has a compass, and it always points in the same direction. I installed a geocaching extension for C|Geo that is supposed to indicate distance and bearing to the target, and it always points to 12:00.
Notes from the developer indicate that this is a known problem with the SDK, where he lists this bullet in the planned features for future development:

Fully implement support for watch compasses (currently not possible due to Android Wear SDK problems).

from: https://github.com/culmor30/cgeo-wear

So it seems that this is a known problem/limitation of the SDK.

Chris Thornton
  • 15,620
  • 5
  • 37
  • 62
  • Kind of funny that my docs would be linked as a source in the same thread I've been watching to try to find a resolution to this problem :p What I meant by "not possible due to Android Wear SDK problems" was that _I_ am having issues with getting it to work, but this is also my first app for Wear so I could be doing it wrong. I have no idea whether this is actually a 'known issue' within AOSP. I've read posts on forums by people saying they've encountered Android Wear compass apps which _do_ somehow work, but I haven't tried any of them for myself. – cjm Jan 17 '15 at 11:58
0

I had the same problem. But only if the watch is paired with moto x 2013 (kitkat 4.4.4). With Asus padfone 2 (kitkat 4.4.2) and with nexus 5 (Lollipop 5.1) i don't have the problem. For exemple I've tried this app : https://play.google.com/store/apps/details?id=jack.campbell.messive.compass

With the moto 360 and nexus 5 works with moto360 and moto x 2013 doesn't works. I don't know why, but i guess with next updates of Android wear will solve.

-1

You want to register a listener and have that listener read the values when they are returned:

sm.registerListener(this, magnetic, SensorManager.SENSOR_DELAY_NORMAL);

Then implement the listener and get the values (eg. something like this):

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 * sensors
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
@Override public void onSensorChanged(SensorEvent event) {

    if(event.sensor.getType() == magnetic.getType()) {
        float mag = event.values[0];
    }
}

@Override public void onAccuracyChanged(Sensor sensor, int accuracy) {

}
juliusspencer
  • 3,008
  • 3
  • 26
  • 30
  • well yes, I do have the listener, but it is never called on the Moto 360. for other sensors (gyro, accelerometer) the listener is called. on a generic android phone, the listener is also called – Ákos Maróy Oct 18 '14 at 15:08
  • I can verify that it's not just the OP having this problem. Has anyone been able to get compass updates from the Moto 360? – cjm Oct 20 '14 at 20:07