The Screenshot API allows your application to take screenshots of the current screen and save them into the phone.
//take a screenshot and save to a file
Screenshot.save('jpg', 50, 'myPrint.jpg')
.then((result) => {
console.log('ok', result.filePath); //should be path/to/myPrint.jpg
})
.catch((error) => {
console.error(error);
});
//take a screenshot and get it as base64 string
Screenshot.URI(40)
.then((result) => {
console.log(result.URI); // should be a base64 encoded string
})
.catch((error) => {
console.error(error);
});
window.Screenshot.save("jpg", 50, "myPrint.jpg")
.then((result) => {
console.log("ok", result.filePath); //should be path/to/myPrint.jpg
})
.catch((error) => {
console.error(error);
});
...
window.Screenshot.URI(40)
.then((result) => {
console.log(result.URI); // should be a base64 encoded string
})
.catch((error) => {
console.error(error);
});
window.Screenshot.save("jpg", 50, "myPrint.jpg")
.then((result) => {
console.log("ok", result.filePath); //should be path/to/myPrint.jpg
})
.catch((error) => {
console.error(error);
});
...
window.Screenshot.URI(40)
.then((result) => {
console.log(result.URI); // should be a base64 encoded string
})
.catch((error) => {
console.error(error);
});
(<any>window).Screenshot.save("jpg", 50, "myPrint.jpg")
.then((result) => {
console.log("ok", result.filePath); //should be path/to/myPrint.jpg
})
.catch((error) => {
console.error(error);
});
(<any>window).Screenshot.URI(40)
.then((result) => {
console.log(result.URI); // should be a base64 encoded string
})
.catch((error) => {
console.error(error);
});
window.Screenshot.save("jpg", 50, "myPrint.jpg")
.then((result) => {
console.log("ok", result.filePath); //should be path/to/myPrint.jpg
})
.catch((error) => {
console.error(error);
});
...
window.Screenshot.URI(40)
.then((result) => {
console.log(result.URI); // should be a base64 encoded string
})
.catch((error) => {
console.error(error);
});
save(type: string, quality: int, filename: string): Promise<string>
Take screenshot with jpg or png file type, custom quality and a defined filename and returns the filepath.
The screenshot files are stored in Application Directory for default.
URI(quality: int): Promise<string>
Take screenshot and get it as Data URI.