앱을 만들고 있습니다.이 시나리오에 문제가 있습니다. 반투명 배경이있는 활동 인 팝업을 표시하고 있습니다. 팝업 사이를 스 와이프 할 수있는 뷰 페이지가 있습니다. 나는이 팝업을 클릭하면 지금 나는 pendingIntent를 실행하려면 ..대기중인 인 텐트를 시작하고 실행중인 활동으로 돌아 가기
모든 지금은 작동하지만 것 (즉이 내게로 만든 것이 아니라 Gmail에서 전달되는 pendingIntent 예를 들어 외부 응용 프로그램 ...에 의해) 문제가 발생했습니다! 팝업을 클릭하여 gMail과 같은 외부 활동을 시작한 경우 마지막 팝업 창을 종료 할 때 다른 팝업이 포함 된 이전 활동으로 돌아 가야합니다.이 은 때때로 발생하지만 항상이 아닙니다! 이는 매니페스트 파일에 android:excludeFromRecents="true"
태그가있는 팝업에 대한 내 활동을 설정했기 때문에 중요합니다. 따라서이 활동으로 돌아갈 수 없으면 보류중인 다른 팝업과 작업 할 수 없습니다.
분명히 역시 android:excludeFromRecents="true"
의 사용이 중요합니다.
어떻게이 문제의 해결책을 찾을 수 있습니까?
여기 내 팝업에서 pendingIntent를 시작하는 방법의 예입니다 : 모든
setOnClickListener(new View.OnViewClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent();
//intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
if(blablabla){
try{
pi.send(context,0,intent);
}
catch(Exception e){}
}
}
});
감사합니다!
편집 :
내 매니페스트 :
<application
android:allowBackup="true"
android:icon="..."
android:label="..."
android:theme="..." >
<activity
android:name="...ActivityApp"
android:label="..."
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name="...NotificationListener"
android:label="..."
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE" >
<intent-filter>
<action android:name="android.service.notification.NotificationListenerService" />
</intent-filter>
</service>
<!-- the activity below contains all the popups -->
<activity
android:name="...Popup"
android:excludeFromRecents="true"
android:launchMode="singleInstance"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Translucent">
</activity>
</application>
그리고 내 청취자 내부 코드의 마지막 조각 팝업이 포함 된 활동 시작 :
@Override
public void onNotificationPosted(StatusBarNotification sbn){
if(sbn.getPackageName().equalsIgnoreCase("com.google.android.gm")){ // GMAIL
Log.d("GMAIL","ok");
...
Intent gmailIntent = new Intent(getBaseContext(), Popup.class);
gmailIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
...
getBaseContext().startActivity(gmailIntent);
}
나는 당신의 질문을 정말로 이해하지 못합니다. 당신의 건축물에 결함이있는 것처럼 보입니다.외부 응용 프로그램을 실행하면 사용자는 홈 단추를 누르거나 알림 표시 줄을 당겨 다른 응용 프로그램으로 이동하여 해당 응용 프로그램을 종료 할 수 있습니다. 귀하의 신청서에 "돌아올"것이라는 보장은 없습니다. 최근 작업 목록에 응용 프로그램이 표시되는 것을 의도적으로 막은 경우 다시 돌아갈 방법이 없습니다. 어쩌면 여기에서 정말로하려고하는 것을 설명해야 할 것입니다. –
내가하려고하는 것은 본질적으로 새로운 알림을 수신하는 서비스 인 앱을 만드는 것입니다.이 앱이 도착하면 알림을 가로 채고 알림에 포함 된 정보로 팝업을 표시합니다. 이제 두 개의 알림이 도착했다고 생각하면 두 개의 팝업이 표시됩니다. 하나의 팝업을 클릭하면 해당 알림의 pendingIntent에 의해 설명 된 활동이 시작됩니다. 이 시점에서 뒤로 버튼을 눌러 내 활동으로 돌아가서 다른 팝업을 클릭해야하지만 뒤로 버튼을 클릭하면 나머지 팝업없이 집으로 돌아갑니다. – Lele
또 다른 중요한 정보. 내 활동이 파괴되지 않았지만 onPause 상태에 있다고 확신합니다! 나는 이것을 Logcat으로 확인했다. – Lele