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

Android 8.0 Oreo Permission (permission denied for window type 2002) #20

Closed
halit4603 opened this issue May 23, 2018 · 5 comments
Closed

Comments

@halit4603
Copy link

I really do not know how to use this library in Android 8.0. "" Permission to crunch an app that does not work. Any help in this regard will be appreciated.

@halit4603
Copy link
Author

I found the answer myself. I first made the following change to the AudioWidget.java file to import the library as a folder, not as dependencies, and then to work seamlessly with both oreo and kitkat versions. I hope someone works.

private void show(View view, int left, int top) {

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
        WindowManager.LayoutParams params = new WindowManager.LayoutParams(
                WindowManager.LayoutParams.WRAP_CONTENT,
                WindowManager.LayoutParams.WRAP_CONTENT,
                WindowManager.LayoutParams.TYPE_PHONE,
                WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
                        | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
                        | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
                        | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
                PixelFormat.TRANSLUCENT);

        params.gravity = Gravity.START | Gravity.TOP;
        params.x = left;
        params.y = top;
        windowManager.addView(view, params);

    } else {
        WindowManager.LayoutParams params = new WindowManager.LayoutParams(
                WindowManager.LayoutParams.WRAP_CONTENT,
                WindowManager.LayoutParams.WRAP_CONTENT,
                WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
                WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
                        | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
                        | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
                        | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
                PixelFormat.TRANSLUCENT);


        params.gravity = Gravity.START | Gravity.TOP;
        params.x = left;
        params.y = top;
        windowManager.addView(view, params);
    }
}

@akashk2512
Copy link

Cool it's working.

VadimHalimendikCr pushed a commit that referenced this issue Nov 13, 2018
@VadimHalimendikCr
Copy link
Collaborator

In version 1.0.1 of the library this was fixed.

@hiralpatel
Copy link

hiralpatel commented Mar 12, 2019

Cool its work for me!!!
Thanks for sharing.

@Arya-pd
Copy link

Arya-pd commented May 10, 2020

can anyone tell me steps how to do this

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

5 participants