2014-02-24 37 views
1

我想倒计时android应用程序的试用版的时间。如何倒数Android应用程序的追踪时间

代码:

DateTime dt = new DateTime(); 
DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); 
DateTime local= dt.withZone(DateTimeZone.forID("Asia/Kolkata")); 
String str = fmt.print(local); 
Toast.makeText(getApplicationContext(), "The time is "+str , 
         Toast.LENGTH_LONG).show(); 

在这里我得到了应用程序的当前时间。我想在安装时获得此信息,并且在安装时获取当前时间后,必须在安装后的30天之后确定一个日期。我怎样才能使用乔达时间库?

如何在安装完成后开始当前时间。

+2

用户可能滥用它作为应用程序可以通过卸载和重新安装可重复使用多次。 –

+0

好的没有问题,我只是想检查有多少人定期更新应用程序,重新安装并不重要。 –

回答

0

使用安装时间从应用程序直接:

long installed = context 
    .getPackageManager() 
    .getPackageInfo("package.name", 0) 
    .firstInstallTime 
; 
+0

对不起,我不能得到你在说什么!我担心的是我想安装完成安装的时间! –

+0

从上面的方法在你的应用程序中,你可以检索你的应用程序的安装时间,在你的应用程序中编码。 –

相关问题