使用Ionic安装和卸载Cordova应用时执行脚本 [英] Execute script when install and uninstall cordova app using ionic

查看:111
本文介绍了使用Ionic安装和卸载Cordova应用时执行脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几年来,我在科尔多瓦工作,而在离子性领域工作不到一年.

For Some years I'm working with cordova and less than 1 year with ionic.

我正在寻找一种在安装和卸载应用程序时运行JavaScript函数的方法.

I'm looking for the way to run a JavaScript function when the app is being installed and when is being uninstalled.

我进行了许多搜索,但未找到任何相关信息,有人知道,至少可以作为一个起点.

I have done many searches but have not found anything about it, someone has an idea, at least an approximation to serve as a starting point?

非常感谢您.

推荐答案

我建议检查以下帖子:

  • Detect uninstall event in phonegap app
  • iPhone - detect first time launch with phonegap

但是,我认为引发一个卸载事件"(最终是由Cordova插件)确实很困难,您的JS代码可以监听该事件.

However I think it's really difficult to raise an "uninstall event" (eventually by a Cordova plugin) which can be listened by your JS code.

相反,在第二篇文章中,建议使用localStorage首次启动应用程序时更容易进行检查.

Instead it's easier to check first time the app is launched using localStorage as suggestend in the 2nd post.

这篇关于使用Ionic安装和卸载Cordova应用时执行脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆