Android Question [Solved] OSMDroid - Compass not showing

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!
 

Attachments

Last edited:

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.
 

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.

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

B4X:
<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.
 
Top