-
Notifications
You must be signed in to change notification settings - Fork 109
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
Android late init carContext crash #164
Comments
So I managed to connect to android auto DHU. And looks like list template works. The main problem remains that even I dont have running AndroidAuto DHU it still fires |
Hey @KestasVenslauskas and community! So for @ReactMethod
fun toast(text: String, duration: Int) {
CarToast.makeText(carContext, text, duration).show()
} to: @ReactMethod
fun toast(text: String, duration: Int) {
if (!::carContext.isInitialized) {
Log.e(TAG, "carContext is not initialized. Cannot show toast.")
return
}
CarToast.makeText(carContext, text, duration).show()
} And then at the beginning of private fun createScreen(templateId: String): CarScreen? {
if (!::carContext.isInitialized) {
Log.e(TAG, "carContext not initialized")
return null
}
// The rest of method...
} I'm not entirely certain what resolved the issue, but following my adjustments, the List template started functioning, the app no longer crashes, and I'm now delving deeper into the library's capabilities! |
I'm having the same issue with @KestasVenslauskas and @BohdanSol solution isn't a fix to the crash issue. carContext is always null. It doesn't show anything on my Android auto emulator *would appreciate some updates |
Describe the bug
Just installed this package with all setup mentioned in documentation for android.
App crashes when creating the template for example
new ListTemplate({...})
Because it already expect carContext to be initialised.
Expected behavior
A clear and concise description of what you expected to happen.
Android Auto (please complete the following information):
Additional context
Interesting that when I call
CarPlay.registerOnConnect(onConnectHandler);
I do get callback called instantly.I just ran the app in a emulator that should not have any android auto or automotive connection yet.
UPDATE: Just tried connecting to android auto HUD before launching the app - same result
The text was updated successfully, but these errors were encountered: