android


Device specific bug with CompassOverlay?


I'm currently developing an app using OSMdroid 5.1 on a Samsung Galaxy Tab E.
My problem here is I can't get the compass to show up at all. I searched hours on the internet and in OSMdroid source code but I couldn't figure it out.
I decided to test it on my personal phone (Samsung Galaxy S4) and turns out it appears and work perfectly on this device.
Tablet is running on Android 5.1.1
Phone is running on Android 5.0.1
I am using Android Studio 2.1
The following is all the code that refers to CompassOverlay.
#Override
public void onResume() {
super.onResume();
compassOverlay.enableCompass();
myLocationOverlay.enableMyLocation();
//mMyLocationOverlay.enableFollowLocation();
}
#Override
public void onPause() {
super.onPause();
compassOverlay.disableCompass();
this.myLocationOverlay.disableMyLocation();
//this.myLocationOverlay.disableFollowLocation();
}
private void mapEndConfig() {
this.osmv.setBuiltInZoomControls(true);
this.osmv.setMultiTouchControls(true);
osmv.getController().setZoom(11);
double lon = -64.5996; //-74.15702819824206; //,45.6294
double lat = 45.6294; //40.64938745451832;
IGeoPoint point = new GeoPoint(lat, lon); // lat lon and not inverse
osmv.getController().setCenter(point);
myLocationOverlay = new MyLocationNewOverlay(this, osmv);
compassOverlay = new CompassOverlay(this, new InternalCompassOrientationProvider(this), this.osmv, mResourceProxy);
osmv.getOverlayManager().add(myLocationOverlay);
osmv.getOverlayManager().add(compassOverlay);
/*anotherOverlayItemArray = new ArrayList<OverlayItem>();
anotherOverlayItemArray.add(new CompassOverlay());
ItemizedIconOverlay<OverlayItem> anotherItemizedIconOverlay
= new ItemizedIconOverlay<OverlayItem>(
this, anotherOverlayItemArray, null);
this.mOsmv.getOverlays().add(anotherItemizedIconOverlay);*/
/*myLocationOverlay.runOnFirstFix(new Runnable() {
public void run() {
osmv.getController().animateTo(myLocationOverlay.getMyLocation());
}
});*/
}
Nobody seems to have encountered something like that with the compass before, does anyone have a solution?
Okay I found the problem. It's because the Samsung Galaxy Tab E does not have a magnetometer for the compass.
When OSMdroid does not detect it, instead of giving an error or warning, it simply does not show it.

Related Links

Android studio Attempt to invoke virtual method on a null object reference
Android canGoBack always false
How to get client and server token in Uber?
Google documents overflow menu
OnCameraIdleListener not found ( OnCameraChangeListener() is deprecated ) _ Android studio?
Android create cardview distance and set layout button
recyclerview with volley loading more datas and display it into UI taking more time
How to open and login to calendar app which is opened by my Application ?
How to display openstreetmap marker information when click the marker icon
At what point or phase of Application INSTALL.REFERRER broadcast Receiver is called?
Make starting up an Activity in a different process faster
Toolbar Android 4.0 - 5.0
Is there a playground / sandbox for Google Play Developer API?
How to make a splash screen efficiently
Espresso can't find a view: NoMatchingViewException
create android circle fragment

Categories

HOME
shell
django
phantom-dsl
cobalt
prism
alexa-skills-kit
yahoo-finance
devise
replace
newrelic
tivoli
aws-cli
cakephp-3.4
vxml
big-o
settings
jtextpane
mql5
distribution
github-enterprise
line
keytool
event-sourcing
symfony-2.8
poedit
rubymotion
spring-async
gulp-watch
postscript
imageresizer
tiki-wiki
definitelytyped
nstimer
magento-1.8
dotspatial
dst
mockjax
batching
swagger-php
imagenet
modernizr
password-protection
doc
naming
chronicle-map
tcc
android-exoplayer
flask-login
snapchat
ovf
lampp
user-defined-fields
rserve
aquamacs
oozie-coordinator
gpg-signature
cd-burning
cvxpy
pure-css
mongodb-php
jquery-jscrollpane
deep
riot
contentcontrol
jaunt-api
state-restoration
r-package
jdi
android-launcher
sapscript
dnssec
ansi
aspectj-maven-plugin
user-permissions
public-html
structuremap3
insight.database
ignite-ui
spring-remoting
clickbank
amslidemenu
windows-embedded-standard
notorm
kendo-dataviz
process-explorer
time.h
pagedown
onload-event
cascadingdropdown
web-notifications
mkv
listitem
gobject-introspection
procedures
htdocs
umra
tmx
twitterizer
cloudfiles
instantiationexception
zen
cfwindow
feasibility
fault-tolerance
great-circle

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App