APICloud实现双击返回键退出APP功能

function exitApp(){
	api.addEventListener({
		name: 'keyback'
	}, function(ret, err){
		api.toast({
			msg: '在次点击返回键退出APP',
			duration:2000,
			location: 'bottom'
		});

		api.addEventListener({
			name: 'keyback'
		}, function(ret, err){
			$api.setStorage("gesture",false);
			api.closeWidget({
			id: 'A6078782752738', //这里需要修改为自己的应用ID
			retData: {name:'closeWidget'},
			silent:true
			});
		});

		setTimeout(function(){
			exitApp();
		},3000)
	});
}

 

展开阅读全文

没有更多推荐了,返回首页