Android lock screen / media controls on the lock screen - android

i have a few questions, to which i haven't found answers till now, despite searching the forum and much of googling.
On thing first, i'm developing for android gingerbread, so newer/not all functions are available.
Is it somehow possible to force the lock screen to redraw/update?
Can i somehow manipulate the built-in media controls on the lock screen, which appear when i'm playing music, through a function/an intent or something? For example that the media controls show the pause state (only the play button is shown) instead of showing the play state (3 buttons are shown). Because i'm developing for gingerbread, i cannot use the RemoteControlClient.
Can i somehow dynamically disable/unregister the appearance of the media controls on the lock screen through code? The media controls on the lock screen shall not be shown despite playing music.
EDIT
Upon the answer of CommonsWare, for the second and third question, i use a cyanogen mod rom, so the media controls are comming from cyanogen.

Is it somehow possible to force the lock screen to redraw/update?
Not really.
Can i somehow manipulate the built-in media controls on the lock screen
Can i somehow dynamically disable/unregister the appearance of the media controls on the lock screen through code?
There are no "built-in media controls on the lock screen" in Android 2.3. Certain devices from certain device manufacturers may have extended their lockscreens support media controls, in which case you would have to ask your questions of those device manufacturers.

Related

How to use the Android lock screen

I want to create an Android application that interacts with the user when the phone is locked
For example the Sony Xperia U (android 4.something) the default mp3 player displays in the lock screen, above the pattern, the name of the song and buttons play, pause, next. In Huawei P8 lite the player displays the aforementioned buttons + the background picture album in an separate screen when you press the power button, and when you slide, it shows the pattern.
I want to do something similar, to display messages from the application to the user, who can press buttons to interact with the application when the phone is locked.
Can this be done without creating new lock screen; (I'm afraid I will do something stupid and lock myself out)
If yes, what activities / permissions / libraries etc should be used;

Volume slider while casting

I need to show the volume slider while casting an audio content to a Chromecast remote.
If I put the app to the background the slider is shown (see this).
The problem is that the framework does not show the slider when the app is not in the background.I guess it is because an application can decide to do something else.
I have tried to call
mAudioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_SAME, AudioManager.FLAG_SHOW_UI);
with no success: the slider that is shown does not have the Chromecast icon and does not report the current volume on the remote. In other words the slider is related with the local audio volume.
is there a way to ask the framework to keep showing the slider even when the app is in the foreground?
Edited
Actually the behaviour even with the VideoCast app is a bit inconsistent. On some phones it is enough to bring the app in the background and make the framework showing the volume slider. After that it will keep showing it even when the app is in the foreground. On other phones this does not work or it is not necessary because the slider is shown correctly.
There is a bit of improvement that can be made; when media is playing back (i.e. if it is not on pause), you can achieve what you want. To see how, you need to override onKeyDown; take a look at the CastVideos-android sample, in class VideoBrowserActivity and try that to see if it does what you'd like or not.
Since you want to show the Chromecast control instead of the generic music control, you need to call:
mAudioManager.adjustSuggestedStreamVolume(AudioManager.ADJUST_SAME,
AudioManager.USE_DEFAULT_STREAM_TYPE, AudioManager.FLAG_SHOW_UI);

Android: Recognising Gestures when screen is locked

I am currently in the process of creating an MP3 player. In particular, the main mode of user input is in the form of (touchscreen) gestural input. I would like to add the functionality allowing users to continue interacting with the MP3 player when the screen is locked. That is, how can I get the device (A Galaxy S3 in particular if it's worth mentioning) to recognise gestures in the lock screen and "parse" them to the MP3 player?
Note: by "locked" I mean when one can see the lock screen (i.e. not when the screen is turned off).
How would I go about doing this?
Thanks in advance.
The recommended way is to make Lock Screen Widgets. These are widgets that allow you to interact with apps in the lockscreen such as the Google Play Music app.
Check out the official tutorial here:
http://developer.android.com/guide/topics/appwidgets/index.html#lockscreen

Android Display content through the Video-out

Does Android have the software capabilities to, if a phone has video-out, to open or push content solely to the video out.
So for example if the user is in and clicks on a YouTube link, the app, instead of opening the content on the main screen over the app it would push it to the video out so the YouTube video would display on their connect display and they could continue to browse.
I know Motorola's have the WebTop software and this idea is similar to what I am trying to accomplish but on a much more basic level. It's more similar to Apples AirPlay but much less complex again (without a network/external player - just video out).
Or if even that is to complex an even simpler solution of having the video-out still output even when the phone is locked. Currently the video-out mirroring on both my HTC Incredible and Galaxy Nexus will stop when the phone is locked.
EDIT:
I've noticed while using my phone that playing a video through the Google Videos app that on the phone controls will overlay on the screen i.e. play, pause, seek bar, and, the soft buttons, but the video-out display (Television) plays the video continuously/seamlessly without any of the controls over-layed. Now this is very primitive example of what i'm ultimately alluding too but it does show a real world example of an android device (no 3rd party manufacture software) doing video out that isn't exactly mirroring.
Well... I hate to furnish this as an answer, but it really looks like there's simply nothing in the API for it at all...
http://groups.google.com/group/android-developers/browse_thread/thread/9e3bcd1eea2c379
which just redirects to:
https://groups.google.com/forum/#!topic/android-developers/Jxp_9ZtzL60
I'm definitely going to favorite this question, and hope someone chimes in with something more useful than a "doesn't look like it's possible, though that does appear to be the correct answer, at this time.
Much like Dr.Dredel has mentioned, there is nothing current for multiple displays in terms of display 1 showing 'A' and display 2 showing 'B'
There is support for multiple screen sizes per the following:
http://developer.android.com/guide/practices/screens_support.html#support
This will be the case for a little while longer until someone creates the support for it.

Is there a list of "best practices" for Android games?

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

Categories

Resources