일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- React Native
- Path Alias
- settings sync
- 네이버 클라우드 플랫폼
- gitlab 연동
- react native #gradle
- 유니옥션
- 초대장
- 티스토리 초대장/ 티스토리초대
- code 설치
- GitLab Mirroring
- visual studio code cli
- 니돈내먹
- GitLab미러링
- '티스토리 초대장/ 티스토리초대'
- 음료같은녹즙
- visual studio code
- Emmet
- eslint-import-resolver-typescript
- 티스토리 초대장
- currentTimeMillis
- 프레시업 #풀무원 #하루한병 #건강만들기 #풀무원 녹즙
- code .
- 프리티어
- 실행시간 측정
- GitHub 미러링
- code 세팅
- GitHub Mirroring
- 티스토리초대
- webstorm
Archives
- Today
- Total
방치하기
백그라운드 문제 본문
반응형
package com.pyo.android.simple.service; , , , , public class SimpleServiceIntent extends android.app.Service { private int increment = 0 ; private static final String DEBUG = SimpleServiceIntent.class.getSimpleName(); @Override public void onCreate() { super.onCreate(); new Thread(new Runnable(){ // Service는보통Thread를이용해백그라운드에서실행시킨다 public void run(){ while(true){ try{ Log.i(DEBUG, " Service is called --" + (++increment) + " --"); Thread.sleep(2000); }catch(InterruptedException ie){ Log.e(DEBUG, " InterruptedException ", ie); } } } }).start(); } public IBinder onBind(Intent intent){ return null; } }백그라운드로 계속 돌기떄문에 onDestory 에서 flag= false로
반응형
Comments