txusballesteros / bubbles-for-android

Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your development.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

app crash

opened this issue · comments

private void addViewToWindow(final BubbleBaseLayout view) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@OverRide
public void run() {
crashes here >>> getWindowManager().addView(view, view.getViewParams());
}
});
}

android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@ce82da -- permission denied for this window type

Solved with this:
if (!Settings.canDrawOverlays(this)) {
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
Uri.parse("package:" + getPackageName()));
startActivityForResult(intent, 3);