원시 푸시 알림을 통해 트리거 된 OnBackgroundActivated()를 가져 오려고하는 현재 UWP 프로젝트에서. 다음과 같이 등록은 : 나는 원시 알림을 보낼 때 (활성)UWP OnBackgroundActivated PushNotificationTrigger (원시 알림)
응용 프로그램이 비주얼 스튜디오와 상태 "다시 시작"에 부착되어var builder = new BackgroundTaskBuilder();
builder.Name = taskName;
builder.SetTrigger(new PushNotificationTrigger());
BackgroundTaskRegistration task = builder.Register();
, 다음 OnBackgroundActivated()가 호출됩니다. 나는 System.Diagnostics.Debug.WriteLine()을 사용하여 그것을 볼 수있다.
응용 프로그램이 Visual Studio 및 상태 "일시 중단"(활성화되지 않음)에 연결되면 OnBackgroundActivated()가 호출되지 않습니다. 그러나 상태를 "Resume"으로 다시 변경하자마자 OnBackgroundActivated()는 앱이 활성화되지 않은 동안 보낸 원시 통지와 함께 호출됩니다. 앱이 다시 활성화 될 때까지 원시 알림이 대기열에 저장되는 것과 같습니다.
앱이 활성화되어 있지 않은데 왜 OnBackgroundActivated()가 즉시 실행되지 않습니까? 이 기능의 주요 목적이라고 생각했습니다.
이 [OnBackgroundActivated 메서드] (https://msdn.microsoft.com/library/windows/apps/windows.ui.xaml.application.onbackgroundactivated.aspx)를 사용하고 있습니까? 'PushNotificationTrigger'를 구현하기 위해 [단일 프로세스 모델] (https://msdn.microsoft.com/en-us/windows/uwp/launch-resume/create-and-register-an-inproc-background-task)을 사용합니까? ? –
예, 단일 프로세스 모델입니다. – user1195883
문제점을 재현 할 수 없습니다. 내 측면에서는 Lifetime Management 이벤트를 "Suspend"로 변경해도 OnBackgroundActivated 메서드가 호출됩니다. 사용중인 OS 버전은 무엇입니까? 문제를 재현 할 수있는 [mcve]를 공유 할 수 있습니까? –