saveImageToGallery
Bắt đầu hỗ trợ ở phiên bản:
- API: 2.16.0
Lưu ý
Với API version ﹤ 2.23.0, phải gọi api login trước khi gọi api này và cần xin cấp quyền tại trang Quản lý ứng dụng
Lưu ảnh vào thư viện ảnh của thiết bị.
Parameters
Object object
Property | Type | Default | Required | Description | Minimum Version |
---|---|---|---|---|---|
imageBase64Data | string | Giá trị base64 của ảnh cần lưu. | |||
imageUrl | string | Đường dẫn của ảnh cần lưu | |||
success | function | Callback function khi gọi api thành công | |||
fail | function | Callback function khi gọi api thất bại |
Sample Code
import api from 'zmp-sdk';
api.saveImageToGallery({
imageUrl: 'https://sample-videos.com/img/Sample-jpg-image-50kb.jpg',
success: (res) => {
// xử lý khi gọi api thành công
},
fail: (error) => {
// xử lý khi gọi api thất bại
console.log(error);
}
});
// hoặc
async () => {
try {
await api.saveImageToGallery({
imageUrl: 'https://sample-videos.com/img/Sample-jpg-image-50kb.jpg'
});
} catch (error) {
// xử lý khi gọi api thất bại
console.log(error);
}
};
Errors
Bắt đầu hỗ trợ:
- API phiên bản: 2.21.0
Code | Message | Note |
---|---|---|
-2004 | Unable to save media |