@@ -0,0 +1,1309 @@
+package org.orange.familylink.alarm;%0A%0Aimport org.orange.familylink.alarm.AccelerometerListener.OnFallListener;%0A%0Aimport android.app.Service;%0Aimport android.content.Intent;%0Aimport android.hardware.SensorEvent;%0Aimport android.hardware.SensorManager;%0Aimport android.os.IBinder;%0A%0Apublic class AlarmService extends Service %7B%0A%09%0A%09/**%0A%09 * %E6%91%94%E5%80%92%E6%A3%80%E6%B5%8BService%0A%09 * @author orange Team%0A%09 */%0A%09//%E5%AE%9E%E4%BE%8B%E5%8C%96%E4%BC%A0%E6%84%9F%E5%99%A8%0A%09private AccelerometerListener mAccelerometerListener ;%0A%09@Override%0A%09%0A%09public IBinder onBind(Intent arg0) %7B%0A%09%09return null;%0A%09%7D%0A%0A%09/**%0A%09 * %E5%9C%A8Service%E5%90%AF%E5%8A%A8%E6%97%B6%E6%89%A7%E8%A1%8C%0A%09 */%0A%09@Override%0A%09public void onCreate() %7B%0A%09%09super.onCreate();%0A%09%09//%E8%BF%9B%E8%A1%8C%E6%91%94%E5%80%92%E6%A3%80%E6%B5%8B%0A%09%09mAccelerometerListener = new AccelerometerListener(this) %7B%0A%09%09%09@Override%0A%09%09%09public void onSensorChanged(SensorEvent event) %7B%0A%09%09%09%09super.onSensorChanged(event);%0A%09%09%09%7D%0A%09%09%7D.setOnFallListener(new OnFallListener() %7B%0A%09%09%09@Override%0A%09%09%09public void onFall(AccelerometerListener eventSource, float%5B%5D raw,%0A%09%09%09%09%09float%5B%5D gravity, float%5B%5D linearAcceleration) %7B%0A%09%09%09%09//%E5%A6%82%E6%9E%9C%E6%91%94%E5%80%92%E5%90%AF%E5%8A%A8%E5%80%92%E8%AE%A1%E6%97%B6Activity%0A%09%09%09%09mAccelerometerListener.setAutoAlarm(AlarmService.this) ;%0A%09%09%09%7D%0A%09%09%7D);%0A%09%09//%E5%8A%A0%E9%80%9F%E5%99%A8%E6%B3%A8%E5%86%8C%0A%09%09mAccelerometerListener.register(this, SensorManager.SENSOR_DELAY_NORMAL) ;%0A%09%7D%0A%0A%09/**%0A%09 * %E5%9C%A8Service%E7%BB%93%E6%9D%9F%E6%97%B6%E6%89%A7%E8%A1%8C%0A%09 */%0A%09@Override%0A%09public void onDestroy() %7B%0A%09%09// TODO Auto-generated method stub%0A%09%09super.onDestroy();%0A%09%09mAccelerometerListener.unregister(this);%0A%09%7D%0A%09%0A%7D%0A

add fall down service