ricvalerio / foregroundappchecker

Foreground application detection library for android.
Apache License 2.0
191 stars 50 forks source link

Context Crashes the App on library call #16

Open JackIrongate opened 4 years ago

JackIrongate commented 4 years ago

I am trying the sample on my android app I try using this

        AppChecker appChecker = new AppChecker();
        String packageName = appChecker.getForegroundApp(ctx);

I tried making a context ctx Not sure which way I am suppose to call it for it to work with your library.

so far I tried Context ctx = getApplicationContext(); and Context ctx = getBaseContext();

Both of them crash the app when it runs the sample code.

I downloaded the library from the download link on github project I added the .aar library to my project fgchecker-1.0.1.aar I added the dependency to my project and I import import com.rvalerio.fgchecker.AppChecker;