Skip to content

Fix the real push-notification crash, add background for the black bar, log widget update failures - #79

Merged
SableWolphen merged 1 commit into
mainfrom
fix-real-push-crash-and-black-bar
Aug 3, 2026
Merged

Fix the real push-notification crash, add background for the black bar, log widget update failures#79
SableWolphen merged 1 commit into
mainfrom
fix-real-push-crash-and-black-bar

Conversation

@SableWolphen

Copy link
Copy Markdown
Owner

Summary

Push-notification crash (root cause confirmed via real Crashlytics stack trace):

  • PushNotifications.requestPermissions() routes through Bridge.getPermissionStates(), a Capacitor core method with an open, unfixed upstream bug (ionic-team/capacitor#8400) — throws a real native NullPointerException, a full app crash that no JS try/catch can ever intercept. Confirmed present on both 1.0.8 and 1.0.9 in Crashlytics, unrelated to the proguard/double-permission-request fixes shipped earlier this session.
  • Added NotificationPermissionPlugin: requests POST_NOTIFICATIONS directly with Android's own permission API, sidestepping Capacitor's broken helper entirely. enableNativeNotifications() uses it first, with a fallback to the old Capacitor call only if that plugin is somehow unavailable.

Black bar:

  • html/body never had an explicit background-color. Android's edge-to-edge extends the WebView under the status bar, and without an explicit background there, that strip can fall back to the WebView's own default canvas color instead of the app's actual color. Set explicitly now.

Widget:

  • The widget's updateWidget call was silently swallowing any failure (.catch(() => {})). Now logs to the console instead, so a real failure is visible in WebView remote debugging / logcat rather than just disappearing with no trace.

Test plan

  • npm test passes
  • Cut a new release build to confirm the new Java plugin compiles cleanly
  • Manual check on a real device: tapping "enable push notifications" no longer crashes, and the status-bar area shows the app's pink background instead of black

Generated by Claude Code

…ar has nothing to show, log widget update failures

The push-notification-enable crash was never actually fixed by the earlier
proguard/double-permission-request changes — got the real Crashlytics stack
trace this time, and it's an open, unfixed upstream Capacitor bug
(ionic-team/capacitor#8400): Bridge.getPermissionStates() throws a real
native NullPointerException when PushNotifications.requestPermissions() is
called, crashing the whole app before any JS try/catch ever gets a chance
to run. Confirmed present on both 1.0.8 and 1.0.9, unrelated to anything
shipped so far this session.

Added NotificationPermissionPlugin, a small native plugin that requests
POST_NOTIFICATIONS directly with Android's own permission API instead of
going through Capacitor's broken helper. enableNativeNotifications() now
calls it first, falling back to the old Capacitor call only if that plugin
is somehow unavailable.

Also: html/body never had an explicit background-color, so the safe-area
strip under Android's edge-to-edge status bar could fall back to the
WebView's own default canvas color instead of the app's actual background
— set explicitly now. And the widget's update call no longer swallows
errors silently, so a real failure is visible in the WebView console/logcat
instead of just disappearing.

Co-authored-by: SableWolphen <309909614+SableWolphen@users.noreply.github.com>
@SableWolphen
SableWolphen merged commit cb96eaa into main Aug 3, 2026
4 checks passed
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

Successfully merging this pull request may close these issues.

1 participant