Skip to content

Conversation

orkun1675
Copy link
Collaborator

@orkun1675 orkun1675 commented Mar 6, 2025

This XXL PR achieves the following:

  • [iOS] Ensures background (headless) Flutter engine is created once and re-used when possible
  • Fixes equality implementation of the new AlarmSet class used by scheduled and ringing streams
  • [iOS] Re-introduces the iOSTimers that are a fallback mechanism incase native->Flutter communication breaks down
  • [iOS] Fixes incompatability with other notification plugins such as flutter_local_notifications
  • [iOS] Re-structures and re-writes the entire iOS plugin using declarative services to be easier to maintain & bug free
  • [Android & iOS] Disables the warning notification after the alarm starts ringing
  • [Android & iOS] Turns off the alarm if the app is force quit while the alarm is ringing
  • [iOS] Resolves race conditions
  • [iOS] Bumps iOS SDK dependency to 13+
  • Upgrades deps

Missing pieces include:

  • iOS error handling: right now errors that occur in services/managers are swallowed and the Flutter side is not informed
  • Comprehensive testing

@orkun1675 orkun1675 changed the title Re-implement iOS native plugin Re-implement iOS native plugin (+ minor features) Mar 6, 2025
@wayupdev
Copy link

Hello guys,

Any news on this PR ?

@wayupdev
Copy link

Hello,

I tested the PR in prod and I have these issues:

Fatal Exception: android.app.RemoteServiceException$ForegroundServiceDidNotStartInTimeException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{fd785c9 u0 com.wayup.way_up/com.gdelataillade.alarm.alarm.AlarmService}
at android.app.ActivityThread.generateForegroundServiceDidNotStartInTimeException(ActivityThread.java:2323)
at android.app.ActivityThread.throwRemoteServiceException(ActivityThread.java:2294)
at android.app.ActivityThread.-$$Nest$mthrowRemoteServiceException()
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2619)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:230)
at android.os.Looper.loop(Looper.java:319)
at android.app.ActivityThread.main(ActivityThread.java:9063)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:588)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)

      Fatal Exception: android.app.ForegroundServiceDidNotStartInTimeException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{f2de671 u0 com.wayup.way_up/com.gdelataillade.alarm.alarm.AlarmService}
   at android.app.ActivityThread.throwRemoteServiceException(ActivityThread.java:1960)
   at android.app.ActivityThread.access$2800(ActivityThread.java:253)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2185)
   at android.os.Handler.dispatchMessage(Handler.java:106)
   at android.os.Looper.loopOnce(Looper.java:201)
   at android.os.Looper.loop(Looper.java:288)
   at android.app.ActivityThread.main(ActivityThread.java:7886)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:568)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)

@wayupdev
Copy link

On the iOS side, the alarm sounds fine and I no longer have any crashes. The only downside is the notifications issue: I still can't use a payload on my notifications when the package is active.

@orkun1675 Congratulations on the PR work!

@orkun1675
Copy link
Collaborator Author

Merging this PR. @wayupdev can you please create bugs for the two issues you mentioned?

@orkun1675 orkun1675 merged commit e7b942e into gdelataillade:main Mar 19, 2025
2 checks passed
@orkun1675 orkun1675 deleted the multi-engine branch March 19, 2025 21:31
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.

3 participants