iPhone - 检测第一次启动与phonegap [英] iPhone - detect first time launch with phonegap

查看:246
本文介绍了iPhone - 检测第一次启动与phonegap的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图检测第一次启动新安装的应用程序,并显示该应用程序的许可协议。用户必须接受lincense或离开应用程序。

I am trying to detect the first time launch of a newly installed application and display a license agreement for the application. The user must accept the lincense or leave the application..

有谁知道我可以如何使用Phonegap这样做?我已经通过主题搜索,但我似乎找不到这里。

Does anyone know how I can do this using Phonegap? I have searched through the topics but I cant seem to find this anywhere.

谢谢

推荐答案

您可以使用本机储存空间的应用程序启动计数。

You can use local storage to keep track of app launch counts.

var applaunchCount = window.localStorage.getItem('launchCount');

//Check if it already exists or not
if(applaunchCount){
   //This is a second time launch, and count = applaunchCount
}else{
  //Local storage is not set, hence first time launch. set the local storage item
  window.localStorage.setItem('launchCount',1);

  //Do the other stuff related to first time launch
}

这篇关于iPhone - 检测第一次启动与phonegap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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