I'm developing both an iOS and Android sender app, and after migrating from Cast SDK v2 to the Cast Application Framework (CAF) I'm no longer able to handle myself the connection to an already running receiver app.
My desired UX here is to prevent auto reconnections when user kills the app and runs it again, the user must explicitly connect again. It seems to me that the Automatic Reconnection feature is kicking on no matter what. On iOS nothing seems to be available, but on Android even setting the proper values seems to have no effect at all.
Are we now forced to use this UX or there is a solution for this? I didn't find anything on the UX guidelines forcing this behaviour.
Thanks
There's a documentation about how to Migrate CCL Sender App to the Cast Application Framework (CAF).
All of the functionality of CCL has been implemented in CAF, so once you migrate, you will no longer need to use CCL.
If you're building a CAF sender app or migrating to CAF, you should be
using CastContext and not GoogleAPIClient for accessing the Cast API.
It is proper to use GoogleAPIClient for accessing other Google Play
services APIs.
For more info about the Reconnection Logic using CAF, read the documentation here.
Related
I have a remote playback device that is not a cast-device (let's call him Johnny 5 for now).
From a client app, I want to be able to cast content to a Chromecast or to my Johnny 5 device. The app is based on the Cast SDK v3.
In order to integrate my non-cast device, I built a Media Router Provider and extended the Session & SessionProvider classes. The Session Provider is added in the getAdditionalSessionProviders method of my OptionsProvider class.
I managed to make things work: my device appears in the list of the detected devices with the Chromecast (thanks to the MediaRouterProvider), and when I select it, session is started, and then I can cast contents on it.
However, it seems like the RemoteMediaClient object is Google-cast specific (cannot be used with non-cast devices), like a lot of Cast SDK features (mini controller, expanded controller...).
Question here regards the Cast Dialog, the Remote Control Notification and the Lock Screen: is that possible to use these with my non-cast device ? Or do I have to code the whole bunch to 'mimic' the Cast SDK features ?
Regarding the Cast Dialog, I would like to be able to customize it to have the same behavior as for the Chromecast without coding my own device picker or overriding the default button behavior.
The majority of work would be on your side, coding most everything for non-cast devices. Cast APIs, as you've noticed, do not interact with Sessions that are not CastSessions. So your options is to write an interface that is already implemented by Cast SDK for cast devices and by you for non-cast devices and try to use that common interface as much as possible. Getting things like lock screen amounts to creating a MediaStyle notification; CastSdk handles that for when there is a CastSession involved and you need to create a similar notification when a different type of Session is involved. This is true for almost all UI elements that the Cast SDK provides out of the box.
How can we disconnect a call in Android. I know this has been asked many times. There are many other answers which state that our app needs to be a system app to disconnect a call but then the answer at this link states that it is not so. But, even the answer there does not help to disconnect the call.
Then I saw that SDK 23 adds a new class Call which the Android document says can be used to handle calls. It has a function called disconnect(). So, how can this be used, if our app is not the dialer app? I only need the data to cut/answer the call. (Don't want to become the default dialer app, nor the system app) https://developer.android.com/reference/android/telecom/Call.html#disconnect()
Could I be guided towards what is the latest information in this regard? For both Marshmallow and pre-Marshmallow devices. I feel the solution to both might be different.
Not sure of the solution for pre-Marshmallow, but for M+ I feel the Call class is to be used.
I don't know if anyone has tried this before but if you are developing an Android platform key signed persistent app with a ContentProvider that is enabled programmatically at runtime using PackageManager#setComponentEnabledSetting(...) you may discover that after enabling it other processes can see the provider (ContentResolver#acquireContentProviderClient(...) returns a non-null client), but all attempts to invoke the provider hang the caller forever. It doesn't matter if you use PackageManager.DONT_KILL_APP or not. I'm not sure if this bug exists in all versions of Android but I am seeing it in Jelly Bean 4.2 (which isn't saying much since there seem to be lots of bugs in that version).
The fix is to use PackageManager.DONT_KILL_APP and then immediately invoke:
android.os.Process.killProcess(android.os.Process.myPid())
Then the process will be restarted and the ContentProvider that was programmatically enabled will start working properly.
I am writing an app which uses the SyncAdapter framework. By default, the user has to activate the sync in the android account settings.
However, I was told that by calling
ContentResolver.setIsSyncable (mAccount, AUTHORITY,1);
I can activate the syncing without any user interaction.
Sadly, this doesn't seem to work. Even after a complete reinstall of the app, the sync adapter service is not running and the account settings look like this:(See screenshot below.)
What could I possibly be missing? Is it a problem maybe that I am calling ContentResolver.setIsSyncable (mAccount, AUTHORITY,1); from the content provider as opposed to the activity?
I want to use C2DM in my android application. I am using code schemas shown in official tutorials. Everything seems to work fine, but I have problem with handling registration properly.
There are 2 methods in C2DMMessaging class which I have to use: firstly register() and next getRegistrationID(). If I use them sequentially, I get null form the getRegistrationID(). The problem is registration is asynchronous. In my application in the beginning I need to know the regidtrationId, I can start the rest of the app only after I get it.
I tried to do some synchronization using monitors (i.e. wait() in register method and notify() in C2DMReceiver.onRegistered()), but it didn't work (the code of onRegistered() hasn't been reached, after calling wait() in register()).
In other words what I need is making registration synchronous, so I could continue, only after I get registrationId. What is the right way to do it?
Make sure you are following below guidelines:
To develop and test on the Android Emulator, you need to download the Android 2.2 version of the Google APIs Add-On into your SDK.
Make sure you set android:minSdkVersion="8" in the manifest.
Make sure you have at least one Google account synced on your emulator or device.