@@ -37,6 +37,9 @@ protected void onCreate(Bundle savedInstanceState) {
3737 super .onCreate (savedInstanceState );
3838 setContentView (R .layout .activity_main );
3939
40+
41+ Monitor .scan ().queryFor (this ).whichPackage ("com.whatsapp" ).
42+ fetchFor (Duration .TODAY );//check usage for specific package.
4043 }
4144
4245 @ Override
@@ -70,9 +73,7 @@ private void init() {
7073
7174 @ Override
7275 public void onItemSelected (AdapterView <?> adapterView , View view , int i , long l ) {
73- // Monitor.scan().getAppLists(this).fetchFor(Duration.TODAY);
74- Monitor .scan ().queryFor (this ).whichPackage ("com.whatsapp" ).
75- fetchFor (Duration .TODAY );
76+ Monitor .scan ().getAppLists (this ).fetchFor (i );
7677 }
7778
7879 @ Override
@@ -82,12 +83,10 @@ public void onNothingSelected(AdapterView<?> adapterView) {
8283
8384 @ Override
8485 public void showProgress () {
85-
8686 }
8787
8888 @ Override
8989 public void hideProgress () {
90-
9190 }
9291 /**
9392 * @param usageData list of application that has been within the duration for which query has been made.
@@ -102,5 +101,7 @@ public void getUsageData(List<AppData> usageData, long mTotalUsage, int duration
102101
103102 @ Override
104103 public void getUsageForPackage (String mPackage , long mTotalUsage , int duration ) {
104+ System .out .println ("Usage for " +mPackage +" is : " +UsageUtils .humanReadableMillis (mTotalUsage )
105+ +" for " + Duration .getCurrentReadableDay (duration ));
105106 }
106107}
0 commit comments