안녕하세요 안드로이드 초보자입니다.
메인 액티비티 버튼을 실행하면 서비스를 실행시키면서 알림창에 알림이 뜨도록 했는데요
여기서 알림창을 클릭하면 다시 메인 액티비티가 뜨도록 하고 싶은데 아무 반응이 없어요
서비스 실행되는 곳에 PendingIntent 를 넣었는데 왜 안되는지 잘 모르겠네요;; 설명 주시면 감사하겠습니다.
public int onStartCommand(Intent aIntent, int aFlags, int aStartId) {
super.onStartCommand(aIntent, aFlags, aStartId);
Log.i("test", "onStartCommand()");
Notification notification = new Notification(R.drawable.ic_launcher, "서비스 실행됨", System.currentTimeMillis());
notification.setLatestEventInfo(getApplicationContext(), "Screen Service", "서비스 실행중", null);
Intent intent = new Intent(this, MainActivity.class);
PendingIntent pi = PendingIntent.getActivity(this, 0, intent, 0);
startForeground(1, notification);
sm.registerListener(this, accSensor, SensorManager.SENSOR_DELAY_NORMAL);
return START_STICKY;
}