Open MCWiener101 opened 8 years ago
Yes, it should work. Just try it out and let us know about the result.
Alright, since it's apparently not supported by ionic-native, I did not get it to work yet.
HI Guys, I did it thanks to this documentation: https://www.thepolyglotdeveloper.com/2016/01/show-native-toast-notifications-in-an-ionic-2-mobile-app/
It was actually pretty easy; one new thing is that you have to put your local images to /src/assets/img and reference them by /assets/img. Good luck!
@sleepybuddha Thanks for sharing that link.
I have tried to reference as /assets/images/ in ionic but its not working.. Tried without beginning slash as well as www/ but none of them is working.
Any suggestion? This is my code.
setWP() {
this.platform.ready().then(() => {
var setImg = "/assets/images/wp.jpg";
window.plugins.wallpaper.setImage(setImg);
});
}
I'm using Social-x-Share plugin and that works fine with www/.. like this.
shareWP() {
this.platform.ready().then(() => {
var shareImg = "www/assets/images/wp.jpg";
window.plugins.socialsharing.share(null, null, shareImg, null);
});
}
So far i'm stuck at this point in ionic. Would appreciate help.
Please provide some console output (if there is any?), that would help.
Here is the output in console log.
/assets/images/wp.jpg home.ts:22
Well, that does not look like an error. You got no further errors?
Did you put your image into /src/assets/{image}
and referenced it by /assets/{image}
as @sleepybuddha suggested?
Yes. Image is inside /src/assets/images folder. And i tried all possible combinations like
/assets/images/wp.jpg
assets/images/wp.jpg
www/assets/images/wp.jpg
/www/assets/images/wp.jpg
../../assets/images/wp.jpg (just tried this and it shows image loading in home.ts file)
None of them worked so far with ionic.
Then I am out of ideas for now. @sleepybuddha put the images directly into the assets
folder (not in the images
subfolder), but I don't think this makes a difference.
Any News?
I can not re-verify the folder now since I only used this for testing; I know that I got it to work after some fiddling around. My actual code uses remote URIs and works now with Ionic3 as well; please verify your syntax:
window['plugins'].wallpaper.setImage(remoteImageURI,function() {
/* Callback does not work yet */
});
Test App working with this Plugin: https://play.google.com/store/apps/details?id=at.startmeapp.mlp
How to refer/use this in typescript.could you please provide me an example
@sleepybuddha I have installed the package ,could you please provide me the usage
Hi, does not work out of the box for ionic2 - do I have to follow these instructions? http://www.gajotres.net/ionic-2-how-to-use-cordova-plugins/
Thanks for help! :)