Javascript I';我一直在修复这个共享短信功能上的一个bug,但是当我通过google messenger应用程序共享时,它不会';t预填充文本体

Javascript I';我一直在修复这个共享短信功能上的一个bug,但是当我通过google messenger应用程序共享时,它不会';t预填充文本体,javascript,android,sms,messaging,Javascript,Android,Sms,Messaging,我一直在研究一个共享短信错误,在尝试预填充短信文本时,它会预填充除google messenger应用程序之外的所有短信服务的文本。这对其他人来说是一个反复出现的问题吗 if (ver == undefined){ //not iOS if (device.isAndroid){ window.location.href = "sms:?body=" + aEncode(shareSMSMsg); } else{

我一直在研究一个共享短信错误,在尝试预填充短信文本时,它会预填充除google messenger应用程序之外的所有短信服务的文本。这对其他人来说是一个反复出现的问题吗

if (ver == undefined){ //not iOS
        if (device.isAndroid){
            window.location.href = "sms:?body=" + aEncode(shareSMSMsg);
        }
        else{
            window.location.href = "sms:?body="+ encode(shareSMSMsg);
        }
}

仅对于google messaging,当用户单击“共享SMS”按钮时调用此操作后,它会将用户带到google messenger,允许用户选择联系人,并用所需文本预填充文本消息。

找到了此问题的解决方案。这是一种不同的方法,但对于共享功能来说,这是一种更好的方法

          if(navigator.share != undefined){
            navigator.share({
              text: shareSMSMsg
            })
            .catch(err => console.error(err));
          }
          else{
            window.location.href = "sms:?body="+ androidEncode(shareSMSMsg); 
          }


找到了这个问题的解决办法。这是一种不同的方法,但对于共享功能来说,这是一种更好的方法

          if(navigator.share != undefined){
            navigator.share({
              text: shareSMSMsg
            })
            .catch(err => console.error(err));
          }
          else{
            window.location.href = "sms:?body="+ androidEncode(shareSMSMsg); 
          }