안녕하세요 간단한 만보기 어플을 제작하고있는 초보개발자입니다
걷기시작버튼을 누르면
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.startForegroundService(walkIntent);
} else {
context.startService(walkIntent);
}
방식으로 서비스를 실행시킨 뒤
Intent notificationIntent = new Intent(this, MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
builder.setContentIntent(pendingIntent);
NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
manager.createNotificationChannel(new NotificationChannel("1", "포그라운드 서비스", NotificationManager.IMPORTANCE_NONE));
}
Notification notification = builder.build();
startForeground(1, notification);
이런느낌으로 포그라운드 노티를 띄우고 있습니다. (업무용 소스라 전체 공개를 하지못하는점 죄송합니다 ( _ _ ) )
걷기는 걸음수를 감지하면, 5초마다 걸음수의 변화를 계산해서 걸음수가 멈췄다고 판단되면 서버로 걸음수를 송신하는 방향으로 제작을했는데요
다 정상적으로 동작을하는데 하루이상 틀어놓으면 언젠지는 모르겠는데 포그라운드임에도 불구하고 휙 꺼져버립니다. ㅠㅠ 하다못해 로그라도 잡히면 어떻게 대처라도하겠는데 소리소문없이 앱이 꺼져버려서 영 답답한 상황입니다.
혹시라도 포그라운드 서비스가 원인모를 사유로 종료가 될때 해당 로그를 어떤방식이든 상관없으니 저장할수있는 방법이 있을까요?!