Compass-View-Library

General

Category
Free
Tag
Compass Sensors
License
Apache License, Version 2.0
Min SDK
8 (Android 2.2–2.2.3 Froyo)
Registered
Jul 5, 2014
Favorites
1
Link
https://github.com/art2limit/Compass-View
See also
CompassView

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

Blurb

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.