Home버튼을 누르면 아무런 문제 없이 돌아갑니다.

 

하지만 Back버튼을 누르면 갑자기 새로운 액티비티를 생성하여 사용하게 되어서

 

공지를 쓸 이유가 없게 만들어 버립니다.

 

인터넷에서 알아본 바론

 

void sendNotification()
{
     Notification n = new Notification();
     n.icon = R.drawable.icon;
     
     n.tickerText = "GPS 수신 시작!";
     
     n.setLatestEventInfo(getApplicationContext(), "WalkStreet", "산책로를 추적 중 입니다.", pendingIntent());
     mManager.notify(createNotificationId(), n);
}
    
PendingIntent pendingIntent()
{
    Intent i= new Intent(getApplicationContext(), mainPage.class);
     i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP);
     PendingIntent pi = PendingIntent.getActivity(this, 0, i, 0);
     return pi;    
}
int mLastId = 0;
List<Integer> mActiveIdList = new ArrayList<Integer>();
int createNotificationId()
{
     int id = ++mLastId;
     mActiveIdList.add(id);
     return id;
}
    
void cancelNotification()
{
     if(mActiveIdList.isEmpty())
     {
          return;
     }
     int id = mActiveIdList.remove(0);
     mManager.cancel(id);
}

 

이런식으로 하면 된다고 해서 했는데 여전히 않되네요...

 

singleTask옵션도 주었습니다. 근데도 않되네요...ㅠㅠ

 

왜 이런지 알려 주시면 정말 감사합니다!!