[Solved] How to make a magnetic feild intensity measurer app in Android – Java [closed]


If you want the values of all axis from the Magnetometer this will do it.
(By default the values is in microTesla)

public class MagnetActivity extends AppCompatActivity implements SensorEventListener{
    private SensorManager sensorManager;
    sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);

    @Override
    public void onSensorChanged(SensorEvent event) {
        if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD) {
            int x_value = event.values[0];
            int y_value = event.values[1];
            int z_value = event.values[2];
            // Do whatever you want to do with these magnetometer values.
    }
}

solved How to make a magnetic feild intensity measurer app in Android – Java [closed]