Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- childProcess = new Thread(new Runnable() {
- public void run() {
- // Пока активен
- while( ! childProcess.isInterrupted()){
- try {
- // что-то делаем
- check();
- } catch(Exception e){
- e.printStackTrace();
- // show message to user
- handleMessage(e, MSG_ERROR);
- }
- try {
- Thread.sleep(1000);
- } catch(InterruptedException e){
- e.printStackTrace();
- break;
- }
- }
- // Пометка об остановки
- getPref().edit().putBoolean("launched", false).commit();
- onServiceStoped();
- stopForeground(true);
- stopSelf();
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement