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.
Apache License 2.0
1.48k stars 281 forks source link

app crash #26

Closed ghost closed 8 years ago

ghost commented 8 years ago

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

ghost commented 8 years ago

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