What phone is it?  Have you tried the ApiDemos examples on it that use the
sensor to see if they work?  Have you tried other applications from Market
on it that are known to work?

On Mon, Jul 4, 2011 at 3:21 PM, Mike D <mdavie...@gmail.com> wrote:

> Thanks for pointing me at the post, it makes sense.
>
> However I'm still only ever getting negative degrees when the phone is
> in landscape no matter which direction I'm sitting.
>
> I did try and find the function Display.getRotation() but I can't seem
> to use that function. I am using getRotationMatrix which is what
> everyone else is using in the examples I've seen.
>
> Anyone got any idea's why my phone is always telling me that North is
> somewhere to my right when it's in landscape? Or is it a fault with
> the phone? I'm using the wildfire google version 2.2.1.
>
> Thanks
> Michael
>
> On Jun 30, 1:13 am, Dianne Hackborn <hack...@android.com> wrote:
> > http://android-developers.blogspot.com/2010/09/one-screen-turn-deserv...
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Wed, Jun 29, 2011 at 10:22 AM, Mike D <mdavie...@gmail.com> wrote:
> > > Hi guys,
> >
> > > I've been playing around with orientation (especially in relation to
> > > the real world so finding north is very useful) and started with the
> > > google api example.
> >
> > > While investigating how to change that so it worked while the phone
> > > was in landscape I found out that I was using depricated components.
> > > So now I'm using the acceloromiter and the magnetic field to find the
> > > orientation which I found in a mixture of examples on the web.
> >
> > > This again works great while in portrain but landscape gives weird
> > > answers?
> >
> > > I've done some experiments with looking at the different between
> > > landscape and portrait but can't seem to find out what's going on and
> > > how to correct the app to allow me to switch between portrain and
> > > landscape on the fly.
> >
> > > I don't think it's quite as simple and minusing 90 degrees but I'm
> > > willing to be wrong.
> >
> > > Here's my SensorListener onSensorChanged
> >
> > > int type = event.sensor.getType();
> > >                float[] data;
> > >                if (type == Sensor.TYPE_ACCELEROMETER) {
> > >                        data = mGData;
> > >                } else if (type == Sensor.TYPE_MAGNETIC_FIELD) {
> > >                        data = mMData;
> > >                }
> >
> > >               for (int i=0 ; i<3 ; i++){
> > >                        data[i] = event.values[i];
> > >                }
> >
> > >                SensorManager.getRotationMatrix(mR, mI, mGData,
> > > mMData);
> >
> > >                SensorManager.getOrientation(mR, mOrientation);
> > >                float incl = SensorManager.getInclination(mI);
> > >                String endl = System.getProperty("line.separator");
> > >                if (mCount++ > 50) {
> > >                        final float rad2deg = (float)(180.0f/Math.PI);
> > >                        mCount = 0;
> > >                        txZ.setText("Azimuth: " +
> > > (int)(mOrientation[0]*rad2deg) + "
> > > degrees" + endl +
> > >                                        "Pitch: " +
> > > (int)(mOrientation[1]*rad2deg) + " degrees" + endl +
> > >                                        "Roll: " +
> > > (int)(mOrientation[2]*rad2deg) + " degrees" + endl +
> > >                                        "incl: "+ (int)(incl*rad2deg));
> > >                }
> >
> > > Many Thanks
> > > Michael
> >
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to
> android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
> >
> > --
> > Dianne Hackborn
> > Android framework engineer
> > hack...@android.com
> >
> > Note: please don't send private questions to me, as I don't have time to
> > provide private support, and so won't reply to such e-mails.  All such
> > questions should be posted on public forums, where I and others can see
> and
> > answer them.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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

Reply via email to