1

I want to connect to chromecast route programmatically, just as posted here: Is it possible to programmatically connect to a chromecast route?

When doing so (calling mMediaRouter.selectRoute(aRouteInfo)), I get an exception java.lang.IllegalStateException: Null media projection manager.

However, when selecting my chromecast receiver via the chromecast button from the popup list, then disconnecting and then calling mMediaRouter.selectRoute(aRouteInfo) again, it works fine.

I assume I have to ask for some kind of permission before. Anyone knows what to do in this case?

The exception will be thrown in this line ...

mProjection = ((MediaProjectionManager) context.getSystemService(Context.MEDIA_PROJECTION_SERVICE)).getMediaProjection(permissionsResultCode, permissionsData);

... the parameter permissionData (Intent) seems to be incomplete.

General Grievance
  • 4,555
  • 31
  • 31
  • 45
ggs
  • 140
  • 1
  • 2
  • 11

1 Answers1

0

I found the (newbie)problem. I just had to create the Intent by myself and react on this within "onActivityResult".

ggs
  • 140
  • 1
  • 2
  • 11