我正在使用一个项目,通过短信向朋友发送firebase动态链接邀请.当我发送较小的链接作为邀请时,我的代码运行完全正常并发送短信.喜欢
try {
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(number, null, "Check It Out. This one is very nice and useful https://v5uht.app.goo.gl/Zi7X", null, null);
Toast.makeText(getApplicationContext(), "Cheers :D :D", Toast.LENGTH_LONG).show();
}
catch (Exception e) {
Toast.makeText(getApplicationContext(), "SMS faild, please try again.", Toast.LENGTH_LONG).show();
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
但是当我包含超过一个sms字符限制的更大链接时它不会发送短信,尽管它显示了吐司通知.
String myNewLink = "https://v5uht.app.goo.gl/?link=http://expensecount.com/&apn=com.chtl.ribath.fdynamic1&amv=1&afl=https://play.google.com/store/apps/details?id%3Dcom.belief.colorgalaxy&myPage=2";
try {
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(number, null, myNewLink, null, null);
Toast.makeText(getApplicationContext(), "Cheers :D :D", Toast.LENGTH_LONG).show();
}
catch (Exception e) {
Toast.makeText(getApplicationContext(), "SMS faild, please try again.", Toast.LENGTH_LONG).show();
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
我该怎么做才能包含myNewLink中的整个链接并使其正常工作.谢谢.
我正在开发一个项目,我必须将图像作为表单数据与其他文本字段一起上传。我首先将文件保存为 Base64 字符串,然后将其转换为文件,然后将其上传到服务器。
const data = await fetch(base64String);
const blob = await data.blob();
const file = await new File([blob], 'avatar', { type: 'image/png' });
Run Code Online (Sandbox Code Playgroud)
我base64String
在将其上传到服务器之前在客户端登录。然后我将其file
作为文件上传到服务器。在将其保存到 MongoDB 之前,当我在服务器端再次将其记录为 Base64 字符串时,我发现我的字符串与以前不同。我觉得在客户端将 base64 转换为文件时我做错了什么。请帮帮我。