We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I think that the possibility to create live wallpapers for android through processing is very fashinating. However once you create the wallpaper you can only set it in the background of your phone through the live wallpaper selector of your mobile, and you can't change any parameter and you can't see the icon in the menu.
Many live wallpapers on the google play store are structured in such a way that you firstly download it as a normal app, secondly, you can see the icon, and by tapping on it you can change the several parameters of the live wallpaper. Finally, usually in this screen there is a button that opens the live wallpaper selector of the mobile, with the preview of the live wallpaper in question yet open(so that you just need to click "apply").
Is there a way to achieve these features through processing?
Thanks.
Answers
Tagging @codeanticode
Kf
To pass parameter to a live wallpaper is tricky (with or without Processing). A live wallpaper is a Service, and, after a service is created, it don´t have access to the shared preferences or another form of persistent data of the app.
However, you can create a class that extend the Application Class:
public class global extends Application
And declares it as final
final global dataglobal = (global) getApplicationContext();
The variables of this instance of the class can be accesed from the service, after the application modifies it.
You can see how it works:
https://play.google.com/store/apps/details?id=com.rafasalas.rugs
and the code:
https://github.com/rafasalas/Rugs
This example don´t use Processing for the graphics. However, using Processing the method is pretty much the same. There is an issue when you try to get the Context from within the PApplet, but it can be easily solved adding a constructor to the sketch and passing the Context as argument.
You can see an example:
https://github.com/rafasalas/Duet