Get Application Installed Date on Android
or this one (API Level 9 upwards!):
long installed = context
.getPackageManager()
.getPackageInfo(context.getPackageName(), 0)
.firstInstallTime
;
How to get current date and time of App Installation date in Android
Are you sure you need
context.getPackageManager().getPackageInfo("package.com.sqlitedemo"
instead of
context.getPackageManager().getPackageInfo("com.sqlitedemo"
Get Application Install time in Android 2.2?
Try this block. This solves your problem
PackageManager pm = getApplicationContext().getPackageManager();
try {
PackageInfo info = pm.getPackageInfo("com.google.android.googlequicksearchbox", 0);
Field field = PackageInfo.class.getField("firstInstallTime");
long timestamp = field.getLong(info);
Date date = new Date(timestamp);
Log.e("DATE", date + "");
} catch (NameNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (SecurityException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IllegalArgumentException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (NoSuchFieldException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IllegalAccessException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
How to get app install time from android
PackageManager pm = context.getPackageManager();
ApplicationInfo appInfo = pm.getApplicationInfo("app.package.name", 0);
String appFile = appInfo.sourceDir;
long installed = new File(appFile).lastModified(); //Epoch Time
Android, Get Installed App Size and Date
Ajay,
To get the installation date you will want to use the PackageManager
class. More specifically the getPackageInfo()
method. This will return to you a PackageInfo
object which contains firstInstallTime
value.
There does not currently exist a public API to get an application's size as PackageManager.getpackageSizeInfo()
was removed from the API from SDK 0.9 to SDK 1.0. See HERE
Good luck!
Related Topics
Android Material Design Inline Datepicker Issue
How to Pass a Message from Flutter to Native
Redirect Users to Itunes App Store or Google Play Store
Isvalidfragment Android API 19
Android: Converting Color Image to Grayscale
Get Signal Strength in Android
Android Ble Connection Time Interval
What Would Happen If Android App Is Released with Debuggable On
How to Play .Mp4 Video in Videoview in Android
Way to Protect from Lucky Patcher/Play Licensing
Music Player Control in Notification
List View Item Swipe Left and Swipe Right
How to Add Radio Button Dynamically as Per The Given Number of Counts