admin管理员组文章数量:1558103
/**
* 时间判断
*/
private void limited() {
Time t = new Time(); // or Time t=new Time("GMT+8"); 加上Time Zone资料。
t.setToNow(); // 取得系统时间。
String time = t.year + "年 " + (t.month + 1) + "月 " + t.monthDay + "日 "
+ t.hour + "h " + t.minute + "m " + t.second;
Log.e("msg", time);
//if (t.year == 2014 && t.month + 1 == 9 && t.monthDay == 23) 测试
// if(t.year!=2020 || (t.month+1)!=5)//这个月
// if(t.year!=2020 || (t.month+1)!=6||t.monthDay!=10) //今天
int mYear=2020,myMonth=6,myMonthDay=30;
if(t.year==mYear && (t.month+1)==myMonth && t.monthDay>=myMonthDay)
{
closeApp();
}else if (t.year>mYear){
closeApp();
}else if (t.year==mYear && (t.month+1)>myMonth){
closeApp();
}
}
/**
* 退出APP
*/
private void closeApp(){
Toast.makeText(IndexMainActivity.this,"试用版时间到自动退出,请联系软件作者微信:18977092827" ,
Toast.LENGTH_LONG).show();
new Handler().postDelayed(new Runnable(){ //延迟执行
@Override
public void run(){
android.os.Process
.killProcess(android.os.Process
.myPid()); // 终止线程
}
}, 3000);
}
版权声明:本文标题:android限制app运行时间限制,android app 限制app使用时间 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dianzi/1727321207a1108340.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论