fix: detect missing Maps API key up front in Android Street View - #401
Merged
Conversation
FIXES_BACKLOG #59: Missing API key is now detected before view construction, preventing a billable Street View event and immediate hard error instead of 12s timeout. - StreetViewManager.kt: Check apiKeyState() before onCreate()/onResume(), emit "apiKeyMissing" error instead of generic timeout when key is missing/unreadable. Skips license-consumed event. - types.ts: Add "apiKeyMissing" to StreetViewErrorReason union - RidePage/GPX/View.tsx: Add onSVError handler that treats apiKeyMissing as hard failure, passes to service layer as mapStateError - StreetViewDemoPage.tsx: Distinguish hard "apiKeyMissing" errors from transient timeouts Manual validation on real Android device with MAPS_API_KEY unset pending.
Extends #59's Android fix to iOS for consistency. iOS's ensurePanorama already avoided the billable GMSPanoramaView allocation and reported a fast onError when the key was missing (no 12s-hang bug on this platform), but used the generic 'unknown' reason shared with other SDK-never-engaged failures. JS consumers (RidePage/GPX/View.tsx, StreetViewDemoPage) now special-case 'apiKeyMissing' as a hard/permanent failure, so iOS needs to emit the same distinguishable reason for a confirmed-missing key. Every other 'unknown' case (provideAPIKey: returning false/throwing) is untouched.
…s a React tag
createViewInstance's apiKeyMissing early-return called emitError from the exact
untagged window where emitLog/emitLicenseConsumed already buffer via PanoramaState
(flushed later from onAfterUpdateTransaction) — emitError had no such buffering, so
emitEvent silently dropped the event (view.context as ThemedReactContext resolves
fine but UIManagerHelper.getEventDispatcherForReactTag needs a real tag). The
pre-existing ready-timeout emitError('unknown') call never hit this because it
fires from a postDelayed callback, by which time the view normally already has
its tag.
Confirmed via real device log on PR #401: the apiKeyMissing billing fix worked
(no license-consumed event), but JS never learned about it and fell through to
the old 15s generic timeout + indefinite retry.
Gives emitError the same buffer-and-flush treatment as emitLicenseConsumed:
PanoramaState.pendingError holds the payload (not just a flag, since the error
carries a reason string), emitError buffers into it when view.id == View.NO_ID,
and flushPendingLogs flushes it alongside the existing logs-then-license flush.
|
gdoumen
marked this pull request as ready for review
August 19, 2026 11:59
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Fixes FIXES_BACKLOG item #59. Android Street View now detects a missing Maps API key immediately instead of hanging for 12+ seconds on a generic timeout.
Changes
StreetViewManager.kt: Check
apiKeyState(context)at the start ofcreateViewInstance, before any view lifecycle methods oremitLicenseConsumed. If the key is missing or unreadable, emit anonErrorwith reason"apiKeyMissing"and return early, skipping the billableonCreate()call and the permanentgetStreetViewPanoramaAsyncwait.types.ts: Add
"apiKeyMissing"to theStreetViewErrorReasonunion type.RidePage/GPX/View.tsx: Add
onSVErrorhandler that treatsapiKeyMissingas a hard/permanent failure. Unlike transient timeouts (unavailable/unknown), this error is passed to the service layer as amapStateErrorto be shown in the start overlay as a dead end.StreetViewDemoPage.tsx: Distinguish
apiKeyMissingfrom transient errors in the demo's status display.Implementation notes
StreetViewPanoramaViewinstance (the return type requires it) but does not callonCreate(),onResume(), oremitLicenseConsumedwhen the key is missing. Per Google's documentation, this avoids the billable event.PanoramaStateand flushed fromonAfterUpdateTransactionlike diagnostic logs.MAPS_API_KEYunset is pending to confirm no Street View panorama instantiation is logged in Google Cloud Console.Test plan
MAPS_API_KEYunset: error should be immediate (no 12s wait), message should be clearChecklist