I'm developing a unity game for android and I'm looking for a way to pause the game whenever a notification pops up on the screen.
This is troublesome because pause menu button is at the top of screen and therefore lies behind the popup message and player cannot click on it.
I already implemented OnApplicationFocus() and successfully pause the game. However I also want to pause in these kind of occasions.
I found this answer for monitoring battery level but I'm looking for a general way for recognizing all kinds of popups.
Related
I have an app that plays media via MediaSessionCompat.
I create a notification for the Notification Drawer using NotificationCompat and post it using NotificationManagerCompat.notify, and it looks great. (See screenshot.)
My problem is with the lock screen. It only shows Play, Previous Track, and Next Track icons. I'm missing the controls to jump back and forward within the currently playing track. (See screenshot.)
I'm using MediaSession.setPlaybackState to specify the actions that are available, and I am including all the appropriate ones from PlaybackStateCompat for rewind, fast forward, skip to previous, and skip to next.
Is the lock screen configured differently than the notification? Or do developers simply have less control over the controls provided here?
Thank you in advance!
I am new to Android TV programming and just managed to have an App that starts a video from an ExoPlayer implementation.
When I hit the HOME-button the home is shown and the content I started appears in the purple marked area. I can resume my App from here.
TV Emulator - Android 10
Can you tell me how this area is called?
How can I control which meta data is shown?
I only found information about the Watch Next Card, but it seems to be something different.
That seems to be the notification area. It's not exclusive to playback.
For example, notifications for a firmware update will also appear there.
To have a proper now playing car and display metadata and other info see this:
https://developer.android.com/training/tv/playback/now-playing.html
I'm writing my first Android game, and though the game itself is working well, I'm not too sure about some of the Android integration aspects of it. Specifically:
Should I provide an in-game volume control?
Should I hide the status bar?
Is the Menu button generally used to pause the game, or should I provide an on-screen control for this?
etc.
Basically I just want my game to do everything the "standard" way. I don't want to frustrate users. Is there some resource (official or not) that lists recommendations for such things? Alternatively, can anyone give me a few important guidelines?
There are no official guidelines how to do this, but some 'Android common sense' would be advisable.
As usual, there is more than one way to do anything, but most of the apps seem to follow the following principles:
full screen games (especially ones in landscape mode) seem to hide the status bar most of the time
you should override the menu button, so it does not get pressed accidentally, but provide a quick way to leave the game
back button usually pauses the app
you do not need in-game volume control since all of existing android devices include a volume rocker, but make turning the volume off available as soon as the game (splash screen) starts, preferably give the person a few moments to turn it off before the music start (a 'would you like to turn the music down?' dialog would be nice)
an (as usually on android) don't count on anything and specify special game requirements (trackpad support, min screen size, ...) in the manifest file
hopefully you can find some more resources online
I want to realise an Android application that shows an always in foreground popup (even in front of the call screen) similiar to the one visible when you use the volume control keys. Sadly, neither toasts nor notifications are sufficient for my needs.
I experimented a lot with #android:style/Theme.Dialog, but the dialogs it creates are mostly not in the foreground.
How do I create what I need or how is the always-foreground popup implemented in Android?
I am building a radio streaming app and was wondering what would be a good design for the back and home buttons.
Should the back button stop playing the music and quit the app? Should the home button allows the music to play in the background? Any suggestions?
The best design in my mind is not to override the default behavior of the back and home buttons.
My player puts a sticky notification into the notification area when play starts with a little persistent play arrow. When you click on the notification, it brings you to the radio controls so you can stop/pause the audio. This way, the user can leave the app using either the home or back key and you don't have to do fancy life cycle stuff to manage the state of the radio.
Don't override the native behavior unless there's a really good reason to. Add your own controls and leave the back button to do what it does. Keep in mind how frustrating it is when the ui suddenly does something unexpected.