flutter_overlay_window
flutter_overlay_window copied to clipboard
App crashes with "Unable to start service flutter.overlay.window.flutter_overlay_window.OverlayService"
on eof my app functionalities displyas periodically message on screen when app it self is in the background to which I use the library. For a lot of users (20%) app crashes and sadly myself I could not repreduce it.
Fatal Exception: java.lang.RuntimeException: Unable to start service flutter.overlay.window.flutter_overlay_window.OverlayService@a6fb6c1 with null: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.content.Intent.getIntExtra(java.lang.String, int)' on a null object reference at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5770) at android.app.ActivityThread.-$$Nest$mhandleServiceArgs() at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2728) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loopOnce(Looper.java:257) at android.os.Looper.loop(Looper.java:342) at android.app.ActivityThread.main(ActivityThread.java:9634) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:619) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:929)
`
<application
android:label="Mind lies"
android:name="${applicationName}"
android:enableOnBackInvokedCallback="true"
android:icon="@mipmap/ic_launcher">
<service android:name="flutter.overlay.window.flutter_overlay_window.OverlayService"
android:exported="false"
android:foregroundServiceType="specialUse">
<property android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="This functionality is needed for affirmations to be displayed even when the app is minimized."/>
</service>
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"`
Preciate any help..
more info: it crashes after a hour or two, (but only on some devices) Maybe race condition? Possible solution on top of the "onStartCommand"...:
if (intent == null) { Log.e("OverlayService", "onStartCommand: Intent is null!"); return START_STICKY; // Or handle appropriately }
??
any fix for this?
@NOTtheKRish
I forked it -> https://github.com/neo-xy/flutter_overlay_window
and added if (intent == null) { Log.e("OverlayService", "onStartCommand: Intent is null!"); return START_STICKY; }
and that fixed the issue although not 100% sure if that is the right way to go as I did not get any confirmation from @X-SLAYER
@neo-xy Thanks for the response... I'll check it with an Internal Testing in Play Store and let you know if the issue is resolved...
@neo-xy Hi mate.... your fork is working fine, but sometimes, while we try to open the overlay, it refuses to start in some android devices (specifically Android 13+)... Any idea why this behaviour?
@NOTtheKRish specificly my fork that does not work on android 13 or the original library has the same issue?
@neo-xy I used your fork in my app, tested using realme Narzo 70x 5G (Android 15) device, and found this issue
ok, i'm guessing that it will be the saem if U test the main version - sadly nothing I can help with; @X-SLAYER is a go to guy for that
I will try to fix it in the next push