createShortcut
Bắt đầu hỗ trợ ở phiên bản:
- API: 2.5.3
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
Cho phép ứng dụng tạo shortcut trên màn hình chờ. Lưu ý: hỗ trợ ios từ API phiên bản 2.16.1.
Quy trình tạo shortcut trên android
Lưu ý: params khác nhau sẽ tạo shortcut khác nhau
Quy trình tạo shortcut trên ios
Parameters
Object object
Property | Type | Default | Required | Description | Minimum Version |
---|---|---|---|---|---|
params | Object<[key: string]: string> | Params cần thêm vào Zalo Mini App khi mở | 2.16.3 | ||
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 { createShortcut } from "zmp-sdk/apis";
const createMiniAppShortcut = () => {
createShortcut({
params: {
utm_source: "shortcut",
},
});
};
Hoặc
import { createShortcut } from "zmp-sdk/apis";
const createMiniAppShortcut = async () => {
try {
await createShortcut({
params: {
utm_source: "shortcut",
},
});
} catch (error) {
// xử lý khi gọi api thất bại
console.log(error);
}
};