Reputation: 1216
I was trying to see how many times an app has been opened/used so far.
Using this I can get a list of ResolveInfos, which contain all packageManagerInfo I might need. But I don't know if there is any field or method that would return me the number of times that this application has been executed/opened.
Or maybe there's a much simpler way I just don't know.
public List<ResolveInfo> getInstalledApps(Context context) {
final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
return context.getPackageManager().queryIntentActivities(mainIntent, 0);
}
Many thanks in advance, Sakura
Upvotes: 3
Views: 1043
Reputation: 8873
Use a shared preference (http://developer.android.com/guide/topics/data/data-storage.html#pref) as a counter.
Upvotes: 2