Skip to content

feat(background): iOS + Android background task templates#13

Open
A-Legg wants to merge 4 commits into
GenericJam:masterfrom
A-Legg:feat/background-tasks-phase-1-templates
Open

feat(background): iOS + Android background task templates#13
A-Legg wants to merge 4 commits into
GenericJam:masterfrom
A-Legg:feat/background-tasks-phase-1-templates

Conversation

@A-Legg
Copy link
Copy Markdown

@A-Legg A-Legg commented May 25, 2026

Summary

Templates for cross-platform Mob background tasks (Phase 1 iOS + Phase 2 Android):

  • iOS: AppDelegate.m.eex silent push + background fetch hooks; Info.plist.eex UIBackgroundModes entries.
  • Android: MobBackgroundWorker.kt.eex WorkManager worker triggered by FCM data messages; MobFirebaseService.kt.eex enqueues worker on mob_background_task FCM key; MobBridge.kt.eex nativeBeginBackgroundTask JNI extern; beam_jni.c.eex nativeBeginBackgroundTask JNI stub; build.gradle.eex work-runtime:2.9.0 dependency.

Changes

  • New: android/app/src/main/java/MobBackgroundWorker.kt.eex
  • Modified: android/app/src/main/java/MobFirebaseService.kt.eex
  • Modified: android/app/src/main/java/MobBridge.kt.eex
  • Modified: android/app/src/main/jni/beam_jni.c.eex
  • Modified: android/app/build.gradle.eex
  • Modified: ios/AppDelegate.m.eex + ios/Info.plist.eex

Related PRs

A-Legg and others added 4 commits May 23, 2026 20:53
Changes:
- AndroidManifest.xml.eex: add com.android.vending.BILLING permission
  for Play Billing (used by mob_iap and any other IAP plugin)
- build.zig.eex: add -Dproject_plugin_sources option that accepts
  comma-separated name:path pairs, allowing mob_dev to auto-discover
  and compile plugin C sources from deps' priv/native/android/jni/

Refs: GenericJam/mob#27
The previous one-line comment didn't capture why the permission is
declared unconditionally vs. gated on a generator flag. Expand it to
document both the rationale (avoid generator complexity) and the
tradeoff (Play Console may warn non-IAP apps about the unused
permission) so users know how to opt out.

Template-only change; no behavior shift.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…hooks

Updates generated project templates to support iOS Background Fetch and
silent push (content-available: 1) per docs/designs/background_tasks.md.

- AppDelegate.m.eex: add didReceiveRemoteNotification:fetchCompletionHandler:
  and performFetchWithCompletionHandler: delegate methods
- Info.plist.eex: add fetch and remote-notification to UIBackgroundModes

Refs: docs/designs/background_tasks.md Phase 1
- Add MobBackgroundWorker.kt.eex: WorkManager worker that calls
  MobBridge.nativeBeginBackgroundTask(uuid, type, payload) and returns
  immediately (BEAM handles the work asynchronously).
- Update MobBridge.kt.eex: add nativeBeginBackgroundTask JNI extern.
- Update beam_jni.c.eex: add JNI stub calling mob_begin_background_task().
- Update MobFirebaseService.kt.eex: detect mob_background_task FCM data
  messages and enqueue MobBackgroundWorker.
- Add androidx.work:work-runtime:2.9.0 to build.gradle.eex.
@A-Legg
Copy link
Copy Markdown
Author

A-Legg commented May 25, 2026

@A-Legg
Copy link
Copy Markdown
Author

A-Legg commented May 25, 2026

Related PRs

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