I want to create a notifications application for desktops which would show notifications/popups only when user is idle. By idle I mean when user can see his/hers desktop wallpaper and no program is blocking a single pixel of the desktop - http://prntscr.com/feorvd.
If someone knows how to better express what I want you are welcome to do edit the topic.
EDIT: I don't want for a popup to show up in the middle of a movie or a game ect. I don't want to be forced to shoo it away because it is blocking content that I want to give all my attention to.
Related
on one screen in my application, I am recording audio.
Scenario: User records audio on this screen. A push comes from our application. The user clicks on this push and another push processing activity is launched.
Result: The user loses his session.
Question: what are the options for handling this case so that the user does not lose his session? Ideally, before switching to a new activity, the application would ask the user if he is sure that he wants to go to another screen, because the session will be lost. But how to track it?
Thanks a lot for your advice
The best solution I have found is to clear all old push notifications in the notification shade when going to the recording screen.
val notificationsManager = getSystemService<Any>(Context.NOTIFICATION_SERVICE) as NotificationManager?
notificationsManager!!.cancelAll()
Further during the recording, if a push notification arrives, I receive this in my service inherited from FirebaseMessagingService in onMessageReceived().
If the recording screen is currently open, I do not show a notification in the notification shade. But I show a widget on the recording screen with the push text and if the user presses it I ask if the user wants to go to another screen because the recording will end.
I hope my experience helps someone. Similarly implemented in Intercom
I'm trying to create an application that automatically clicks pictures as you carry your phone around, the point is that it clicks pictures as you do your own business.
This question is basically what I'm looking for with the added functionality of taking pictures every n seconds. I wanted to know if there was something more efficient than this method (shrinking the preview window to 1x1).
background service is not recommended. You can use foreground service for this job.
You need to give media and camera access permission in the code. Then you can run the capture function with n second delay and while loop as many times as you want.
there are some examples, i don't want to repeat them.
capture, save and show example
take photo without ui
I want to detect long presses in volume key in a service. Here are my options:
A) Let the user control volume from the lock screen
I wan't to detect if the user has held down the volume button in a service while the screen is off. I already tried (for 2 days) doing it with contentObserver, but the problem is that contentObserver detects volume changes, and volume doesn't change when the screen is off. Is there any way I can let the user control volume from the lock screen?
B) Detect long press for volume button from service
How can I do this? Are there any broadcast receiver's that I can use while the screen is off? Is there a way to implement the dispatchKeyEvent in a service?
I have seen this, but for me the second answer doesn't work in the background. I think the easiest way would be option A because I already have everything set up for when the user changes volume, so can I let the user control volume from lock screen? If not, is there anything else I can do?
Thanks so much,
Ruchir
Some background:
I have a turn based game where you can play several concurrent games in separate windows. Each window/game has it's own chat and also a kind of game action panel that turns up when it's your turn to act.
The issue:
Game windows will steal focus whenever it becomes your turn to act in any of the games you're playing, this is by design but very annoying if you're involved in chatting at any of your games because when focus is lost that chat will no longer receive your key board strokes.
What I want:
Some way to dispatch key board events to a JTextField that's no longer the focus owner (and also in a different window/JFrame than the current focus owner). Is there some way to do this? And how?
Plan b would be to set some kind of timer on the chat and let the window refuse to give up focus until x amount of time has passed since the last key stroke in the chat, but it might not be ok to stall the focus switch since your action time is limited already.
You can set alwaysOnTop of the current chat window true while there's text in the chat text field by calling:
java.awt.Window
public final void setAlwaysOnTop(boolean alwaysOnTop)
throws SecurityException
When user presses Enter or clicks on Send button reset the alwaysOnTop so other windows could steel the focus.
I might have found what I was looking for here. Remains to be seen if I'll try to use it or if we'll change the requirements :)
See this link to find a working SSCCE on how to redispatch KeyEvents to any text component.
I'm writing a presentation app which is supposed to present on the 2nd display in extended mode.
For that I want to have a "Start presentation" button which reflects the actual state of external display connections: it should be gray and non-clickable if no external displays are connected. And it should be enabled if there is at least one connected.
I have seen the GraphicsEnvironment class but it only has getXXX methods. It's inefficient because I will have to check the state every few seconds and the state updates not immediately.
Is there a callback method on display connection or something like that for this purpose?
Thanks
Shuo