Set volume with Chromecast when Android app is in the background - android

I'm developing an app for Android that streams content to a Chromecast device.
I did not find the documentation about the way to change the volume of the remote media player when the app is in the background.

Look at the method setUpRemoteControl() in VideoCastManager class, in CCL; it is mostly done there.

It was enough to call:
mediaRouter.addRemoteControlClient(mRemoteControlClient);
where:
mMediaRouter = MediaRouter.getInstance(context);

Per the CastCompanionLibrary detailed documentation:
CCL can provide default lock screen controllers based on the RemoteControlClient. If desired,
this feature needs to be enabled at the initialization time of the VideoCastManager. When this
feature is enabled, a Play/Pause button will be shown on Android devices running Jelly Bean or
above. On KitKat devices, the layout of the lock screen controllers is different and uses a
full-screen album art while on Jelly Bean it is a small version of the album art.
In addition, when this feature is enabled, CCL provides the ability for users to control the Cast
device’s system’s volume even if the application is in the background. On KitKat devices, it provides that capability even if the screen is off
For the CastVideos-android sample, they do that in CastApplication immediately after intialization of VideoCastManager:
mCastMgr.enableFeatures(
VideoCastManager.FEATURE_NOTIFICATION |
VideoCastManager.FEATURE_LOCKSCREEN |
VideoCastManager.FEATURE_DEBUGGING);

Related

How to support new ambient mode in android wear?

Since last update Android Wear has a new feature - the always-on mode. This means that the Android Wear device doesn’t turn off the screen; it changes to the ambient mode to save battery and keeps certain apps running in the background.
How exactly should I implement this?
p.s. I'm developing sport application, not watchface.
We have also created a code lab to run through the steps. Please find it here:
https://io2015codelabs.appspot.com/codelabs/always-on#1
What you're looking for is how to support "Ambient Mode" in your Wear app's activity.
There is an entire doc dedicated to this:
http://developer.android.com/training/wearables/apps/always-on.html
As well as a code sample:
https://github.com/googlesamples/android-AlwaysOn/

Android Display via HDMI

I have a client that's asking for an app that can play videos from a tablet to connected HDMI screens. I'd like to know if it's possible to show different output on the HDMI screen than the tablet itself? This is because I want to add a menu (layer on top of the tablet screen) that is accessible by the client and is not visible to the people seeing the TV Screen.
Thanks for the help.
That is possible since Android 4.2, see the release notes which also contain code samples:
Android now allows your app to display unique content on additional
screens that are connected to the user’s device over either a wired
connection or Wi-Fi. To create unique content for a secondary display,
extend the Presentation class and implement the onCreate() callback.
Within onCreate(), specify your UI for the secondary display by
calling setContentView(). As an extension of the Dialog class, the
Presentation class provides the region in which your app can display a
unique UI on the secondary display.
The Presentation Class in the SDK contains a code sample how to play a video and show some information at the same time on a second screen.

what is different in Android 5.0 (LOLLIPOP) notification?

I have bunch of apps that use notifications work for Android 4.4 and lower. Are these notifications going to work in android 5.0? If not, how to set notifications in Android 5.0?
You do not have to change anything, only functionality is added.
Android Lollipop - Notifications:
Notifications in Android 5.0 are more visible, accessible, and
configurable.
Varying notification details may appear on the lock screen if desired
by the user. Users may elect to allow none, some, or all notification
content to be shown on a secure lock screen.
Key notification alerts such as incoming calls appear in a heads-up
notification—a small floating window that allows the user to respond
or dismiss without leaving the current app.
You can now add new metadata to notifications to collect associated
contacts (for ranking), category, and priority.
A new media notification template provides consistent media controls
for notifications with up to 6 action buttons, including custom
controls such as "thumbs up"—no more need for RemoteViews!
In android 5.0 (Lollipop) only functionality has increased.So Lollipop will support all lower API apps without fail.
Read more about Lollipop here - Android Lollipop

How to automatically add widget to the lock screen 4.2

I want my music widget to be shown on the screen in a similar way that RemoteControlClient works. I don't want the users to be needed to have the widget added to the lock screen beforehand. The samsung music app on thier 4.2 devices have this behaviour.
AFAIK, this isn't possible in the public SDK. Samsung's apps may be able to do it on their device because they are developed by Samsung for their own devices and have greater access as preinstalled system apps.
No API that I am aware of does this as of now.

Android: launching flash app as a screensaver

i am new to android development and had question regarding custom screen saver.
The requirement is for a tablet which will always be plugged in so battery life wouldn't be
an issue. The required app should behave as a screensaver in that during inactivity, the tablet should launch this app which contains a flash file that displays a series of images and video. When activity is resumed then the tablet takes the user back to the program they were using.
Can this be done via an app without requiring any hacks?
cheers,
abhi
There is no concept of a "screensaver" in Android.
There is the lock screen, which can be modified via custom firmware, though AFAIK it is implemented in Java as part of the OS and therefore could not be replaced via a Flash APK.

Categories

Resources