Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use react-native-navigation with react-native-google-cast? #5

Closed
jedashford opened this issue Jun 28, 2018 · 3 comments
Closed

Comments

@jedashford
Copy link

jedashford commented Jun 28, 2018

It looks like you specific mention this here:

If you already extend other class than ReactActivity (e.g. if you use react-native-navigation) or integrate React Native in native app, make sure that the Activity is a descendant of android.support.v7.app.AppCompatActivity. Then add CastContext.getSharedInstance(this); to your Activity's onCreate method (this lazy loads the Google Cast context).

If MainActivity extends NavigationActivity and I add CastContext.getSharedInstance(this); to the onCreate method, then I get build errors. Am I missing something else?

build errors (I assume this is due to not extending GoogleCastActivity. Does that mean I must extend GoogleCastActivity?):

    @Override
    ^
1 error
:app:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.```
@jedashford jedashford changed the title How to we use react-native-navigation with react-native-google-cast? How to use react-native-navigation with react-native-google-cast? Jun 28, 2018
@petrbela
Copy link
Member

I've only tested it briefly but you should be able to make it work without extending GoogleCastActivity.

What method is the @Override on?

@petrbela
Copy link
Member

petrbela commented Jan 11, 2019

To get the Cast button working I think you need to extend either FragmentActivity, GoogleCastActivity, or AppCompatActivity.

Please reopen at https://github.com/react-native-google-cast/react-native-google-cast/issues if it's still an issue.

@petrbela
Copy link
Member

petrbela commented Jan 11, 2019

Hmm also initializing the cast context in MainApplication instead of MainActivity as suggested by #25 might help. That throws java.lang.IllegalStateException: The activity must be a subclass of FragmentActivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants