0
내 응용 프로그램에서 현재 로컬 알림을 표시하고 있습니다.알림 실행중인 작업 또는 실행중인 부분
여러 개의 단편과 관련된 단일 활동이 있습니다. A, B, C 단편과 관련된 MainActivity라고 말하십시오.
그래서 알림이 나타나면 앱을 최소화하고 알림을 클릭합니다. 그 때 앱이 열리고 싶습니다 (최소화 된 상태).
아무 것도 없거나 앱이 종료되었다고 가정하면 앱을 새로 엽니 다.
어떻게 해결할 수 있습니까?
그 날 여기 일어나고하지내 코드입니다 :
NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
Intent MyIntent = new Intent();
MyIntent.setClassName("com.my.app.", "com.my.app.MainActivity");
MyIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
MyIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
MyIntent.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
PendingIntent StartIntent = PendingIntent.getActivity(mContext,0,MyIntent, PendingIntent.FLAG_CANCEL_CURRENT | Notification.FLAG_AUTO_CANCEL);
Notification mNotification = new Notification.Builder(mContext)
.setTicker("My App")
.setContentTitle("My App")
.setContentText("Thank you for tap to go back!!!")
.setSmallIcon(R.drawable.notification)
.setContentIntent(StartIntent)
.build();
int NOTIFICATION_ID = 1;
notificationManager.notify(NOTIFICATION_ID , mNotification);