启动一个服务去完成一个耗时的任务,如读取数据库上报,任务完成后,需要自己关闭。 在Serivce内部的关闭方式: 方式一 Log.d(TAG, "stopService"); Intent bindIntent = new Intent(this, MyService.class); stopService(bindIntent); 方式二 Log.d(TAG, "stopSelf"); stopSelf();