nativescript中跳转发送短信和打电话页面

/**
 * @description 发短信
 * @param params 
 */
export function makeTexting(params:{sms}):boolean {
    let applicationAndroidIns = ApplicationAndroidIns
    if(isAndroid){
        let intent = new android.content.Intent(android.content.Intent.ACTION_SENDTO);
        console.log('params.sms=====>',params.sms)
        let data = android.net.Uri.parse("sms:" + params.sms);
        intent.setData(data);
        intent.setFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
        applicationAndroidIns.context.startActivity(intent);
        return true
    }else if(isIOS){
        UIApplication.sharedApplication.openURL(NSURL.URLWithString(`sms://${params.sms}`));
        return true
    }else{
        return false
    }
}

你可能感兴趣的:(nativescript)