Android Open Source - MakeWithMotoSampleApp Custom Sensor Manager






From Project

Back to project page MakeWithMotoSampleApp.

License

The source code is released under:

GNU General Public License

If you think the Android project MakeWithMotoSampleApp listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.makewithmoto.extras;
//  w w  w.j  a  v a  2 s.c om
import java.util.Vector;

import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;


public class CustomSensorManager {

  private final static String TAG = "CustomSensor";


  Context c;
  private static Boolean supported;
  private static boolean running = false;

  boolean sensorSupported;
  
  Sensor sensor;

  Vector<CustomSensorListener> listeners; 


  SensorManager sensormanager;
  SensorEventListener listener;

  public CustomSensorManager(Context c) {
    listeners = new Vector<CustomSensorListener>();
    sensormanager = (SensorManager) c.getSystemService(Context.SENSOR_SERVICE);

  }
  
  public boolean isListening() {
    return false;
  }

  public void start() {
    running = true;
    sensorSupported = sensormanager.registerListener(listener, sensor, SensorManager.SENSOR_DELAY_GAME);
  }

  public void stop() {
    running = false;
    sensormanager.unregisterListener(listener);
  }
  
  public void addListener(CustomSensorListener listener) {
    listeners.add(listener);
  }

  public void removeListener(CustomSensorListener listener) {
    listeners.remove(listener);
  }


}




Java Source Code List

android_serialport_api.SerialPort.java
com.makewithmoto.boards.MAKr.java
com.makewithmoto.boards.MIOIOListener.java
com.makewithmoto.bt.BluetoothSerialService.java
com.makewithmoto.bt.BluetoothViewer.java
com.makewithmoto.bt.DeviceListActivity.java
com.makewithmoto.bt.SimpleBT.java
com.makewithmoto.example.ActivityBT.java
com.makewithmoto.example.ActivityMAKr.java
com.makewithmoto.example.ActivityMOIO.java
com.makewithmoto.example.Application.java
com.makewithmoto.example.LauncherActivity.java
com.makewithmoto.extras.AccelerometerManager.java
com.makewithmoto.extras.CustomSensorListener.java
com.makewithmoto.extras.CustomSensorManager.java
com.makewithmoto.extras.WhatIsRunningInterface.java
com.makewithmoto.extras.WhatIsRunning.java
com.makewithmoto.fragments.CameraFragment.java
com.makewithmoto.fragments.DebugFragment.java
com.makewithmoto.fragments.EmptyFragment.java
com.makewithmoto.fragments.GraphFragment.java
com.makewithmoto.fragments.ImageFragment.java
com.makewithmoto.fragments.Utils.java
com.makewithmoto.fragments.VideoPlayerFragment.java
com.makewithmoto.fragments.VideoTextureFragment.java
com.makewithmoto.views.CanvasUtils.java
com.makewithmoto.views.PlotView.java