You can integrate the sharing capability into your quick game to gain increased exposure and traffic through users' sharing behavior. System Share allows content to be shared to other apps on the phone, third-party sharing enables content distribution through specific third-party platforms (such as WeChat), and Tap to Transfer allows users to share game content by tapping devices.
Call qg.systemShare to share content.
qg.systemShare({
type: "text/plain",
data: "this is a message from quick game.",
success: function () {
console.info('share text success');
},
fail: function (errMsg, errCode) {
console.info('share text fail --- ' + errCode + ':' + errMsg);
},
cancel: function () {
console.info('share cancel');
},
complete: function () {
console.info('share complete');
}
})qg.chooseImage({
count: 1,
sourceType: ['album', 'camera'],
success(res) {
// chooseImage returns an array.
const tmpPaths = res.tempFilePaths;
qg.systemShare({
type: "image/*",
data: tmpPaths[0], // Use the first path.
success: function () {
console.info('share pick image success');
},
fail: function (errMsg, errCode) {
console.info('share pick image fail --- ' + errCode + ':' + errMsg);
},
cancel: function () {
console.info('share cancel ');
},
complete: function () {
console.info('share complete ');
}
});
}
});Call qg.serviceShare to share content.
qg.serviceShare({
shareType: 1,
title: "Sharing Title",
summary: "Sharing digest",
success: function (data) {
console.info('share success');
},
fail: function (data, code) {
console.info('share failed:' + data + "," + code);
},
cancel: function () {
console.info('share cancel');
}
})qg.serviceShare({
shareType: 2,
imagePath: '/' + this.nativeImage.nativeUrl,
success: function (data) {
console.info(' share success');
},
fail: function (data, code) {
console.info(' share failed:' + data + "," + code);
},
cancel: function () {
console.info(' share cancel');
}
})