Skip to content

imsugat/cordova-plugin-wallpaper

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Title Description
Set Wallpaper
Set an image within the application cordova as wallpaper.

npm version

Code Climate Issue Count

Android
Build Status

cordova-plugin-wallpaper

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.

Table of Contents

  1. Installation
  2. Usage
  3. License
  4. Supported Platforms

Installation

stable npm package:

cordova plugin add cordova-plugin-wallpaper

maybe unstable GitHub-repository:

cordova plugin add https://github.com/fbsanches/cordova-plugin-wallpaper.git

Usage

Function(s)

setImage

Sets image under given path as systems background image:

window.plugins.wallpaper.setImage(string /* image path */);
Notes
  • path must not start with bar
  • path has not to start with backslash
Example
window.plugins.wallpaper.setImage('img/mybackground.jpg');

setImageHttp

Sets image from url as background image:

window.plugins.wallpaper.setImageHttp(string /* url */);
Example
window.plugins.wallpaper.setImageHttp('https://example.com/image.jpg');

setImageBase64

Sets image contained in Base64 string as systems background image:

window.plugins.wallpaper.setImageBase64(string /* Base64 string */);
Example
window.plugins.wallpaper.setImageBase64(base64);

Callbacks

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.');
  }
});

License

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.

Supported Platforms

  • Android

About

Cordova Set Wallpaper Plugin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 51.9%
  • JavaScript 48.1%