Getting magnetic field results as degrees

by Mark Murphy » Tue, 15 Dec 2009 08:45:31 GMT


Sponsored Links
 


That's because you don't.

 http://github.com/commonsguy/cw-advandroid/tree/master/Sensor/Compass/ 

Or, to quote from the docs:

"Sensor.TYPE_ORIENTATION:

All values are angles in degrees.

values[0]: Azimuth, angle between the magnetic north direction and the Y
axis, around the Z axis (0 to 359). 0=North, 90=East, 180=South, 270=West"

 http://developer.android.com/reference/android/hardware/SensorEvent.html 

What you are trying to do is not use the compass
(Sensor.TYPE_ORIENTATION), but rather the raw magnetic field
(Sensor.TYPE_MAGNETIC_FIELD). *That* might need trigonometry to achieve
what you need, but I suspect the vast majority of things that need the
compass can just use the degrees supplied by the compass.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Android Consulting/App Development:  http://commonsware.com/consulting 

--



Other Threads

1. Live Wallpaper not Showing up on Market for Moto Droid w/ OTA 2.1

And this is the initial release and the version I wanted to use:

<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.yakloinmobile.lw.physics"
    android:versionCode="101"
    android:versionName="1.01">

    <uses-sdk android:minSdkVersion="7" />
    <uses-feature android:name="android.software.live_wallpaper" />
    <uses-permission android:name="android.permission.VIBRATE" />

    <supports-screens
        android:smallScreens="true"
        android:normalScreens="true"
        android:largeScreens="true"
        android:anyDensity="true" />

    <application
        android:icon="@drawable/icon"
        android:label="@string/app_name">

        <service
            android:label="@string/app_name"
            android:name=".WaterPhysicsToyLiveWallpaper"
            android:permission="android.permission.BIND_WALLPAPER">
            <intent-filter android:priority="1">
                <action
android:name="android.service.wallpaper.WallpaperService" />
            </intent-filter>
            <meta-data
                android:name="android.service.wallpaper"
                android:resource="@xml/main" />
        </service>

        <activity
            android:label="@string/settings"
            android:name=".WaterPhysicsToySettings"
            android:theme="@android:style/
Theme.Light.WallpaperSettings"
            android:exported="true" />

    </application>

</manifest>



> 

2. Problems with SSL Socket connection

I have socket based Transport. SSL cerificate also is in use in this
case.
I use this transport from standart Swing client - works fine. When I
try set it up to
Android application bacame following Exception :

05-27 08:31:24.332: WARN/System.err(223):
java.security.NoSuchAlgorithmException: SSLContext SSL implementation
not found
05-27 08:31:24.342: WARN/System.err(223):     at
org.apache.harmony.security.fortress.Engine.getInstance(Engine.java:
104)
05-27 08:31:24.352: WARN/System.err(223):     at
javax.net.ssl.SSLContext.getInstance(SSLContext.java:58)
05-27 08:31:24.352: WARN/System.err(223):     at
com.dukascopy.transport.common.mina.ssl.SSLContextFactory.createClientSSLContext(SSLContextFactory.java:
158)
05-27 08:31:24.352: WARN/System.err(223):     at
com.dukascopy.transport.common.mina.ssl.SSLContextFactory.getInstance(SSLContextFactory.java:
80)
05-27 08:31:24.362: WARN/System.err(223):     at
com.dukascopy.transport.client.ClientConnector.run(ClientConnector.java:
105)


Have looked at many Android forums, and didn't find any solution...
Except this ->
http://stackoverflow.com/questions/995514/https-connection-android

But TLS is not ok for me.

I can not belive that on Android SDK is not possible create SSL
connection in standart way. (not http connection...)

Thanks! Hopefully anybody have experience with this

-- 

3. Ringtone picker calls onActivityResult() too early

4. how to download file from android web view file link?

5. parallax

6. JTwitter OAuth

7. Javascript problem with Webview runing under a HTC Desire