Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoking setWallpaper inside workmanager yields PlaformException #15

Open
innomatica opened this issue Nov 24, 2022 · 2 comments
Open

Comments

@innomatica
Copy link

I want to change the wallpaper in the background at a certain point. WorkManager invokes

AsyncWallpaper.setWallpaperFromFile(localFilePath);

and creates following PlatformException

E/MethodChannel#async_wallpaper(14385): Failed to handle method call
E/MethodChannel#async_wallpaper(14385): java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.Activity.startActivity(android.content.Intent)' on a null object reference
E/MethodChannel#async_wallpaper(14385): 	at com.codenameakshay.async_wallpaper.AsyncWallpaperPlugin.home(AsyncWallpaperPlugin.java:158)
E/MethodChannel#async_wallpaper(14385): 	at com.codenameakshay.async_wallpaper.AsyncWallpaperPlugin.onMethodCall(AsyncWallpaperPlugin.java:210)
E/MethodChannel#async_wallpaper(14385): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/MethodChannel#async_wallpaper(14385): 	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/MethodChannel#async_wallpaper(14385): 	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/MethodChannel#async_wallpaper(14385): 	at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/MethodChannel#async_wallpaper(14385): 	at android.os.Handler.handleCallback(Handler.java:938)
E/MethodChannel#async_wallpaper(14385): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/MethodChannel#async_wallpaper(14385): 	at android.os.Looper.loopOnce(Looper.java:201)
E/MethodChannel#async_wallpaper(14385): 	at android.os.Looper.loop(Looper.java:288)
E/MethodChannel#async_wallpaper(14385): 	at android.app.ActivityThread.main(ActivityThread.java:7839)
E/MethodChannel#async_wallpaper(14385): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#async_wallpaper(14385): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/MethodChannel#async_wallpaper(14385): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

Any suggestion would be appreciated.

TIA,

Flutter:

  • version: 3.3.9
  • channel: stable

Dart:

  • version: 2.18.5
@jjfster
Copy link

jjfster commented Dec 28, 2023

Did you ever get this working?

@innomatica
Copy link
Author

No I didn't.

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

No branches or pull requests

2 participants