raceyi / Ionic2Samples

6 stars 7 forks source link

background android oreo #1

Open anes118 opened 5 years ago

anes118 commented 5 years ago

app.components.ts 파일에

this.backgroundMode.enable();

this.backgroundMode.on("activate").subscribe(()=>{ console.log("background mode has been activated"); //this.backgroundMode.disableWebViewOptimizations(); });

this.backgroundMode.on("deactivate").subscribe(()=> { console.log("background mode has been deactivated"); });

위와같이 코딩 후 카메라, 위치정보 등이 실행되는 화면으로 이동하면 앱이 종료되는 오류가 발생하고 있습니다

raceyi commented 5 years ago

백그라운드에서 카메라와 위치정보를 실행할수 있는지 확인이 필요합니다. 안드로이드 인가요? iOS인가요? iOS의 경우 enable도 필요 하구요. 찾아보니 위치정보는 백그라운드에서 가능한듯싶습니다.

anes118 commented 5 years ago

안드로이드이고요 카메라 시작하는 시점에 최초로 // background mode 중지 this.backgroundMode.disable(); <- 해당 처리를 해주면 문제없이 실행은 되는 것 같습니다. 근데.. disable() 메서드 실행 후 카메라 관련 이벤트 완료 후에 다시 enable() 처리를 하게되면 background 상태에서 정상적으로 푸시 등을 받을 수 있는지 궁급합니다.

raceyi commented 5 years ago

이렇게 사용해본적은 없지만 가능해야 합니다.