Compass-View-Library

Additional

Language
Java
Version
1.0.3 (Feb 12, 2018)
Created
Nov 26, 2013
Updated
Feb 12, 2018
Owner
Artemiy G (art2limit)
Contributors
jrocharodrigues
ludovicroland
Artemiy G (art2limit)
3
Activity
Badge
Generate
Download
Source code
APK file

Announcement

Screen-gifs

Important

For correct library working arrow should be see straight up like this ⬆

Import

Add it in your root build.gradle at the end of repositories:

 allprojects {
  repositories {
   ...
   maven { url 'https://jitpack.io' }
  }
 }

And on module build.gradle

dependencies {
     compile 'com.github.art2limit:Compass-View:1.0.3'
 }

In your activity or fragment init CompassSensorManager and create CompassView like this:

    private CompassSensorManager compassSensorManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        ...
        compassSensorManager = new CompassSensorManager(this);

        CompassView compassView = new CompassView(this);
        compassView.init(compassSensorManager, location1, location2, R.drawable.icon_arrow);
    }

    @Override
    protected void onResume() {
        ...
        compassSensorManager.onResume();
    }

    @Override
    protected void onPause() {
        ...
        compassSensorManager.onPause();
    }

Don't forget call onResume and onPause, if you don't battery will be cry.