android - 使cordova android应用程序在30天后过期
问题描述
我试图在我的科尔多瓦应用程序中设置到期时间,这将强制关闭应用程序或允许我显示带有自定义消息的页面。
解决方案
在 localStorage 的帮助下。
document.addEventListener('deviceready', function(){
if (typeof window.localStorage.getItem('someKey') === 'undefined'){
window.localStorage.setItem('someKey', new Date() );
}else{
var current = new Date().getTime();
if(current > ( window.localStorage.getItem('someKey') + 2592000 ) ){
/// Expired
}
}
});
推荐阅读
- python - 将任务发送给 celery 中的两个单独的工人
- powerbi - 如何按所需顺序显示切片器中的多选值 - Power BI
- vba - MS Word set OutlineDemote to text after specific word
- flutter - FutureBuilder 不刷新新数据
- r - 在列表的数据框中设置一列等于 R 中列表中数据框的名称
- php - 使用 phpmailer 向 webmailer (hostinger) 发送电子邮件
- api - 在 Nginx 后面大摇大摆
- string - 如何从函数返回拆分字符串 (&str)?
- c++ - 为什么我不能从 txt 文件中删除特定行?
- mysql - XAMPP mySQL 文件上的错误日志,mySQL 意外关闭