액티브 스킬/플러터

<플러터> 인앱업데이트 - 강제업데이트 후 재실행 안될 때

디벅잉 2023. 1. 10. 22:48
728x90

 

🧭

 

in_app_update

안드로이드 강제업데이트를 위해 인앱업데이트를 지원하는 in_app_update 라이브러리를 사용해 보았습니다.

업데이트 옵션으로 강제업데이트, 선택업데이트가 있습니다.

강제업데이트 시에는 업데이트 후 앱이 자동으로 재실행되어야 하지만 재실행 없이 종료만 되었습니다.

 

singleTop vs singleTask

AndroidManifest.xml 파일을 보면 <Activity> 아래로 다음과 같은 옵션이 있습니다.

android:launchMode="singleTop"

해당 옵션을 singleTop에서 singleTask로 변경해주면 강제업데이트 후 앱이 재실행됩니다.

android:launchMode="singleTask"

singleTop과 singleTask의 차이점은 아래 두번째 링크를 참고해 주시기 바랍니다.

차이점을 봐도 재실행과의 연관성이 이해되지 않았습니다.

플러터 개발을 하더라도 Android 네이티브 공부를 게을리 할 수 없는 이유가 하나씩 늘고 있습니다.

 

📌

 

https://github.com/jonasbark/flutter_in_app_update/issues/82

 

Immediate update does not restart the app automatically after installing. · Issue #82 · jonasbark/flutter_in_app_update

Hi, When we perform a flexible update, the app restarts automatically after installing the update, but in the case of immediate update it installs the update but does not restart the app automatica...

github.com

https://yebon-kim.tistory.com/6

 

그림으로 이해하는 Activity LaunchMode 실험👩‍🔬

저는 AndroidManifest에서 한 Activity가 여러 번 인스턴스화 되는 것을 피하기 위해 SingleTask 또는 SingleInstance를 구분하지 않고😓 적어주곤 했습니다. 특히 비밀번호 재입력 같이 똑같은 뷰에서 로직만

yebon-kim.tistory.com

 

728x90