Title | Description |
---|---|
Set Wallpaper |
Set an image within the application cordova as wallpaper. |
Android |
---|
This simple plugin gives you the ability of setting the systems wallpaper, either by using an image you brought with the application in its www-directory or by using a Base64-encoded string of an image. This lets you choose the image after the installation of the application and even change it afterwards, you just have to pass over a new Base64 encoded image.
stable npm package:
cordova plugin add cordova-plugin-wallpaper
maybe unstable GitHub-repository:
cordova plugin add https://github.com/fbsanches/cordova-plugin-wallpaper.git
Sets image under given path as systems background image:
window.plugins.wallpaper.setImage(string /* image path */);
- path must not start with bar
- path has not to start with backslash
window.plugins.wallpaper.setImage('img/mybackground.jpg');
Sets image from url as background image:
window.plugins.wallpaper.setImageHttp(string /* url */);
window.plugins.wallpaper.setImageHttp('https://example.com/image.jpg');
Sets image contained in Base64 string as systems background image:
window.plugins.wallpaper.setImageBase64(string /* Base64 string */);
window.plugins.wallpaper.setImageBase64(base64);
Every function provides optional callbacks. The callback provides an error parameter in case there is an error. If there is no error, everything went well:
window.plugins.wallpaper.setImage('path/to/image.png', function(error) {
if (error) {
console.error(error);
}
else {
console.log('Success setting wallpaper.');
}
});
The plugin is licensed under Apache 2.0. The Apache 2.0 license can be found in the root directory of this project as well as the projects NOTICE.
- Android