Open mohamadAliMotlagh opened 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.
this library is not working in API26, API27. how can i fix it in these versions?
I've fixed it by downloading the sources and changing the following:
startService
with startForegroundService
for API 26+ in StandOutWindow.java, line 119TYPE_PHONE
with TYPE_APPLICATION_OVERLAY
for API 26+ in StandOutWindow.java, line 1813And keep in mind that the persistent notifications needs a notification channel.
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
@rubenmx I've fixed the notification but Floating window is not showing startForegroundService
is not working
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.
@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 :(
@rubenmx my bad i was using TYPE_SYSTEM_OVERLAY
instead of TYPE_APPLICATION_OVERLAY
Unable to add window android.view.ViewRootImpl$W@8d54593 -- permission denied for window type 2002