As the title says, CastContext.getSharedInstance(Context)
is now deprecated:
getSharedInstance(Context context): This method is deprecated. Use getSharedInstance(Context, Executor) instead to handle the exception when Cast SDK fails to load the internal Cast module. https://developers.google.com/android/reference/com/google/android/gms/cast/framework/CastContext
What would be the correct way to specify an Executor and return the CastContext? I got it working like this but I wonder if this is the best way to do it:
CastContext
.getSharedInstance(context, Executors.newSingleThreadExecutor())
.addOnSuccessListener(castContext -> {
//do something with castContext
})
.addOnFailureListener(exception -> {
//throw exception
});