Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

packageName returns null #12

Open
LorenceHernandez opened this issue Nov 18, 2018 · 2 comments
Open

packageName returns null #12

LorenceHernandez opened this issue Nov 18, 2018 · 2 comments

Comments

@LorenceHernandez
Copy link

AppChecker appChecker = new AppChecker();
        appChecker.whenAny(new AppChecker.Listener() {
                    @Override
                    public void onForeground(String packageName) {
                        Log.d("foreground: ", "" + packageName);
                    }
                }).timeout(1000)

packageName always give me null.
Im calling the code inside a service,

TIA.

@imspikey
Copy link

Are you sure that Allow usage tracking is enabled?
I had the same problem and after showing the permission and enabled it it worked fine

@ricvalerio
Copy link
Owner

@dragneel30,

Like @imspikey suggested, please confirm you added the right permissions, and also request them in runtime. Try to run the example and see if it works on the same device.

The reason why it returns null is because it's not capable of retrieving the packageName, and one of the reasons is permissions not having been granted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants