pingpongboss / StandOut

StandOut lets you easily create floating windows in your Android app.
http://pingpongboss.github.com/StandOut
MIT License
1.24k stars 379 forks source link

in Android O not showing view #43

Open mohamadAliMotlagh opened 6 years ago

mohamadAliMotlagh commented 6 years ago

Unable to add window android.view.ViewRootImpl$W@8d54593 -- permission denied for window type 2002

RupeshVM commented 6 years ago

I'm having same issue. I solved using

Intent myIntent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION); myIntent.setData(Uri.parse("package:" + getPackageName())); startActivityForResult(myIntent, APP_PERMISSIONS);

But still stand out window not showing for oreo.

johnpiao305 commented 6 years ago

this library is not working in API26, API27. how can i fix it in these versions?

rubenmx commented 6 years ago

I've fixed it by downloading the sources and changing the following:

And keep in mind that the persistent notifications needs a notification channel.

tabish075 commented 6 years ago

Only notification is working but the Window is not showing please help

I didn't got any errors just floating window is not showing on API >= 26

tabish075 commented 6 years ago

@rubenmx I've fixed the notification but Floating window is not showing startForegroundService is not working

rubenmx commented 6 years ago

Did you change TYPE_PHONE within the StandOutLayoutParams constructor to TYPE_APPLICATION_OVERLAY for API 26+? That was the reason it wasn't showing with my code. TYPE_PHONE is no longer supported.

tabish075 commented 6 years ago

@rubenmx public static void show(Context context, Class<? extends StandOutWindow> cls, int id) { if (Build.VERSION.SDK_INT >= 26) { context.startForegroundService(getShowIntent(context,cls,id)); } else { context.startService(getShowIntent(context, cls, id)); } } And this is the constructor

super(200, 200, TYPE_SYSTEM_OVERLAY, StandOutLayoutParams.FLAG_NOT_TOUCH_MODAL | StandOutLayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, PixelFormat.TRANSLUCENT);

no luck :(

tabish075 commented 6 years ago

@rubenmx my bad i was using TYPE_SYSTEM_OVERLAY instead of TYPE_APPLICATION_OVERLAY