Skip to content

chore: update Android demo app and build guide#2583

Merged
fadi-george merged 8 commits into5.7-mainfrom
fg/fix-android-demo
Mar 18, 2026
Merged

chore: update Android demo app and build guide#2583
fadi-george merged 8 commits into5.7-mainfrom
fg/fix-android-demo

Conversation

@fadi-george
Copy link
Contributor

@fadi-george fadi-george commented Mar 18, 2026

Description

One Line Summary

Overhaul the Android demo app to follow the shared build guide, fix bugs, and clean up code.

Screenshot 2026-03-17 at 6 19 48 PM

Details

Motivation

The Android demo app needed to be updated to align with the new shared build guide (sdk-shared/demo/build.md), add missing features, fix bugs, and follow best practices.

Scope

All changes are scoped to examples/ — no SDK source changes.

Build guide:

  • Replaced the 900-line monolithic build.md with a concise Android-specific guide that references the shared generic guide
  • Corrected Compose setup, notification permission auto-request location, and WITH SOUND notification details

Demo app features:

  • Added "WITH SOUND" push notification button (sends android_channel_id referencing the dashboard-configured channel with vine_boom.wav)
  • Added "CLEAR ALL" notifications button
  • Changed app bar title from "Sample App" to "Android"
  • Changed splash/launch background from red to white

Bug fixes:

  • Fixed loading spinner getting stuck on login (was relying solely on onUserStateChange callback to dismiss — now calls fetchUserDataFromApi() directly)
  • Fixed corrupt vine_boom.wav (was an HTML page, replaced with actual WAV file)

Code cleanup:

  • Replaced all android.util.Log with LogManager in Repository so logs appear in the in-app log view
  • Routed promptPush() through the repository instead of calling OneSignal.Notifications directly
  • Fixed observer leak in MainViewModel.onCleared() — was only removing push subscription observer, now removes all three (push, permission, user state)
  • Deduplicated HTTP code in OneSignalService — extracted getSubscriptionIdIfOptedIn(), postJson(), and sendNotificationPayload() helpers
  • Removed dead code: unused SharedPreferenceUtil.exists(), fixed getOneSignalAppId() return type from String? to String
  • Removed redundant kotlinx.coroutines.delay(100) and duplicate error logging
  • Removed manual NotificationChannel creation (SDK handles it via dashboard config)
  • Simplified MainApplication initialization

Testing

Manual testing

  • Tested login/logout flow — loading spinner dismisses correctly
  • Tested WITH SOUND notification — plays vine_boom sound
  • Tested CLEAR ALL — clears notification tray
  • Verified white splash screen on launch
  • Tested on Pixel device with Android 14

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
  • I have reviewed this PR myself, ensuring it meets each checklist item

Made with Cursor

@fadi-george fadi-george changed the base branch from main to 5.7-main March 18, 2026 01:30
@fadi-george fadi-george merged commit 1d8de99 into 5.7-main Mar 18, 2026
2 checks passed
@fadi-george fadi-george deleted the fg/fix-android-demo branch March 18, 2026 16:21
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.

2 participants