Android Question [Solved] OSMDroid - Compass not showing

Discussion in 'Android Questions' started by mark35at, Feb 26, 2015.

  1. mark35at

    mark35at Well-Known Member Licensed User

    This is driving me crazy. All works well apart from the fact that the compass will not show. I have stripped the code out to a barebones sample and it runs and works. I cannot see my mistake. Any help (Hint: Warwound) would be great - thanks.

    Code for B4A 3.80 is enclosed.

    Edit: Using the emulator is not a good idea. Debug mode (legacy or rapid), selecting open map leads to a black screen. The app seems to stop at line 69 in Mapview. There is no error, it just waits???

    The same happens on my Samsung Galaxy Tab 2 if I use debug mode but it then reboots????

    On my old LG P990 phone it works great, including compass!

    Attached Files:

    Last edited: Feb 26, 2015
  2. warwound

    warwound Expert Licensed User

    This is a bit of a FAQ with OSMDroid - both the b4a and native android library have users reporting the compass not showing.

    It is connected to whether or not hardware acceleration is enabled.
    A manifest edit can enable or disable hardware acceleration for your entire application or for individual activities.

    I think with recent versions of android (Honeycomb and newer) hardware acceleration is enabled by default - though am not 100% sure on that.

    So try to disable hardware acceleration and see if that works.
  3. mark35at

    mark35at Well-Known Member Licensed User

    Thanks Warwound. I was going to try your advice but then started to compare the two apps I have. One works and the above doesn't. Your keyword was the manifest. There I found the answer.

    <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14"/>
    - Does not work, no compass and scale

    <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8"/>
    - Works great! Or take out the target all together works as well.

    Could this also be what you meant. When the target is set "high" then the acceleration is turned on?

    Many thanks.
  4. warwound

    warwound Expert Licensed User

    Yes i think hardware acceleration is enabled by default with Honeycomb+, disabled by default on older versions.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice