How to set wallpaper of image in ionic app?


I’m building wallpaper app.
Is there any ionic method to implement set as wallpaper of image in ionic app?
I tried using cordova-plugin-wallpaper plugin to set an image inside ionic app(ionic card tag) as wallpaper on my device.Link to cordova plugin:
After installing using “cordova plugin add cordova-plugin-wallpaper” command in command prompt project location.I tried using plugin function “window.plugins.wallpaper.setImage(string /* image path */);” to set image i stored in my www image folder.But when i click on ionic card to set as wallpaper its showing “Runtime Error
Cannot read property ‘wallpaper’ of undefined” error on ionic lab localhost.
Is there any other way to set image as wallpaper in ionic? OR How to use this cordova plugin to set wallpaper from an image in ionic?
Full explanation:
I’m using <ion-card (click)=“setwall()”> in home.html to call setwall() in home.ts.
setwall() is a function i use inside home.ts export class HomePage {}.
Code for setwall():
window[‘plugins’].wallpaper.setImage(‘img/3.jpg’); }
Help me solving this as i’m losing hope in this.
Thanking in advance.


u need to declare window before @Component & @IonicPage()


declare var window;

  selector: 'page-full',
  templateUrl: 'full.html',

// somewhere in your code set as wallpaper..