Cordova:应用程序在使用相机后重新启动
Cordova: App restarting after using the camera
我正在使用离子框架开发移动应用程序。
当我尝试使用 cordova 相机插件(拍照或访问图库)时,应用程序重新启动。
我在这里发现了很多关于这个主题的论坛帖子和问题,最有用的是这个:
PhoneGap camera restarts the application
这个问题已有 4 年历史了,我认为给出的解决方案不再与更新版本的 cordova 兼容。
问题有没有新的解决办法?我已经被这个问题困扰了 3 天。
question you mention may be 4 years old, but the issue remains the same: Android is killing off your Cordova app activity while it has been put in the background and the camera activity is in the foreground (see the Cordova documenation对问题的详细解释)。
accepted answer to that question的本质也仍然正确,但提到的插件已过时/尚未针对新版本的 Cordova 进行更新。
我建议使用最近更新的分支之一(例如 https://github.com/zebra1024/cordova-plugin-wezka-nativecamera) of cordova-plugin-wezka-nativecamera
as the foreground camera plugin, since the original repo 已经 2 年没有更新,并且与最新版本的 Cordova 有问题。
也许您的选项变量中的目标类型设置为 DATA_URL,这会导致此处提到的崩溃
https://github.com/apache/cordova-plugin-camera#module_Camera.DestinationType
可能您设置了一些 platform.resume
事件侦听器,在您拍照后会调用该事件侦听器。我就是这种情况,camera activity 在返回应用程序时会调用 resume,所以请确保你在那里没有重定向,我想知道是否有一种方法可以识别 platform.resume
是由 camera actvity 调用的.除此之外,请始终确保您拥有最新版本的 ionic/cordova/plugins.
我正在使用离子框架开发移动应用程序。 当我尝试使用 cordova 相机插件(拍照或访问图库)时,应用程序重新启动。
我在这里发现了很多关于这个主题的论坛帖子和问题,最有用的是这个: PhoneGap camera restarts the application
这个问题已有 4 年历史了,我认为给出的解决方案不再与更新版本的 cordova 兼容。
问题有没有新的解决办法?我已经被这个问题困扰了 3 天。
question you mention may be 4 years old, but the issue remains the same: Android is killing off your Cordova app activity while it has been put in the background and the camera activity is in the foreground (see the Cordova documenation对问题的详细解释)。
accepted answer to that question的本质也仍然正确,但提到的插件已过时/尚未针对新版本的 Cordova 进行更新。
我建议使用最近更新的分支之一(例如 https://github.com/zebra1024/cordova-plugin-wezka-nativecamera) of cordova-plugin-wezka-nativecamera
as the foreground camera plugin, since the original repo 已经 2 年没有更新,并且与最新版本的 Cordova 有问题。
也许您的选项变量中的目标类型设置为 DATA_URL,这会导致此处提到的崩溃 https://github.com/apache/cordova-plugin-camera#module_Camera.DestinationType
可能您设置了一些 platform.resume
事件侦听器,在您拍照后会调用该事件侦听器。我就是这种情况,camera activity 在返回应用程序时会调用 resume,所以请确保你在那里没有重定向,我想知道是否有一种方法可以识别 platform.resume
是由 camera actvity 调用的.除此之外,请始终确保您拥有最新版本的 ionic/cordova/plugins.