1,在AndroidManifest.xml注册Service
<service Android:name=".service.SensorService" >
<intent-filter>
<action android:name="ITOP.MOBILE.SIMPLE.SERVICE.SENSORSERVICE"/>
</intent-filter>
</service>
2,在Activity中调用
final Intent intent = new Intent();
intent.setAction("ITOP.MOBILE.SIMPLE.SERVICE.SENSORSERVICE");
stopService(intent);