Reference Android Sender w/ Framework API: CastVideos-android application shows how to cast videos from an Android device that is fully compliant with the Cast Design Checklist.
Apache License 2.0
345
stars
183
forks
source link
Cast receiver app not launching on android 11 for the first time when tv starts #132
### NOTE: This problem is happening on android 11 or higher android tv only when i first time start the tv or the tv in screensaver/sleep mode instead it opens the fallback url on web receiver
Sender Option provider
public class CustomCastOptionsProvider implements OptionsProvider {
@Override
public CastOptions getCastOptions(Context context) {
List<String> supportedNamespaces = new ArrayList<>();
supportedNamespaces.add(context.getString(R.string.custom_namespace));
LaunchOptions launchOptions = new LaunchOptions.Builder()
.setAndroidReceiverCompatible(true)
.build();
return new CastOptions.Builder()
.setReceiverApplicationId(context.getString(R.string.cast_application_id))
.setSupportedNamespaces(supportedNamespaces)
.setLaunchOptions(launchOptions)
.build();
}
@Override
public java.util.List<SessionProvider> getAdditionalSessionProviders(Context context) {
return null;
}
### NOTE: This problem is happening on android 11 or higher android tv only when i first time start the tv or the tv in screensaver/sleep mode instead it opens the fallback url on web receiver
Sender Option provider
public class CustomCastOptionsProvider implements OptionsProvider {
}
Sender AndroidManifest.xml
<meta-data android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME" android:value="com.frenzee.app.CustomCastOptionsProvider" />
Sender start session
castContext.getSessionManager().endCurrentSession(true); Intent castIntent = new Intent(); castIntent.putExtra("CAST_INTENT_TO_CAST_ROUTE_ID_KEY", route.getId()); castIntent.putExtra("CAST_INTENT_TO_CAST_DEVICE_NAME_KEY", route.getName()); castIntent.putExtra("CAST_INTENT_TO_CAST_NO_TOAST_KEY", false); castContext.getSessionManager().startSession(castIntent);
Receiver options provider
public class MyReceiverOptionsProvider implements ReceiverOptionsProvider {
}
receiver AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">