async_wallpaper
async_wallpaper copied to clipboard
Invoking setWallpaper inside workmanager yields PlaformException
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
Did you ever get this working?
No I didn't.