![]() ![]() Should be able to do something in Xam.Android like: GetWindow().setFlags(_APPLICATION_OVERLAY, _APPLICATION_OVERLAY) Try to port this line of Java Android code to Xamarin: I do realize that _APPLICATION_OVERLAY is not a specific bit flag but a combination of several bit flags for convenience, so it is easy enough to provide the constant value and cast it to WindowManagerFlags, but I would expect, also for convenience, for these convenience constants to be available in the WindowManagerFlags enum. I see in the mappings that only the values in WindowManager.LayoutParams that start with FLAG_ are being generated as enum values in WindowManagerFlags, which makes sense. I would expect this in the WindowManagerFlags enum. In your manifest file just give the permission Īddition to this you can also check for the API level if its >=23 then if( can't find this constant bound anywhere in Mono.Android: windowManager = (WindowManager)getSystemService(WINDOW_SERVICE) įinal LayoutParams myParams = new LayoutParams( Finally I got the answer for this I don know how much is it reliable but my app is not crashing now. I tried my best to try all the examples available for this issue. I'm testing on an HTC Desire 620 DS running Android 4.4.2 ![]() WindowManager.LayoutParams params = new WindowManager.LayoutParams( MView = mInflater.inflate(R.layout.lock_screen_notif, null) LayoutInflater mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE) Here are the permissions in my manifest file: Īnd this is the code I use to add the Window to the lock screen WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE) Solution that I have implemented but I am still getting the same error. ![]() To add the following permission in the Manifest file. These posts ( here, here and here) all give the same answer. I figured I could probably do it with _KEYGUARD_DIALOGīut every time my app crashes with the following error:Ī$BadTokenException: Unable to add - permission denied for this I'm working on an app where I need to display a window with some info ON the Lock Screen (KeyGuard) without unlocking the phone. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |