我使用以下代码从 Android 应用程序启动默认短信活动以发送短信:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("sms:"));
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
但我想直接在我的EditText包含文本消息的文本中设置一些文本(当我启动默认短信活动时,该文本EditText为空)。我怎样才能做到这一点 ?
问候,
I am using this code to send sms:
This code could be found in many tutorials but it is not working in Oreo, i have sent the correct answer
public void sendSms(String phone) {
if(null != phone) {
final Intent i = new Intent(Intent.ACTION_VIEW);
i.setType("vnd.android-dir/mms-sms");//<-- maybe problem is here
i.putExtra("address", phone);
startActivity(Intent.createChooser(i, getString(R.string.sms)));
}
}
Run Code Online (Sandbox Code Playgroud)
I have tested this code in Android 4 to Android 6 and no problem but in Android 8.1 google api emulator says no app can …
构建一个 C# 程序,该程序将向选择接收文本消息的客户发送文本消息。有谁知道 Spectrum Mobile 的网关?
我正在尝试向手机发送短信,但我有一个问题:我无法收到消息,但模拟器告诉我消息已经发送.
这是我的代码,
import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.telephony.SmsManager;
import android.view.View.OnClickListener;
import android.widget.Toast;
import android.view.View;
public class sendsms extends Activity {
Button buttonSend;
EditText textPhoneNo;
EditText textSMS;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sending);
buttonSend = (Button) findViewById(R.id.BTNSENDSMS);
textPhoneNo = (EditText) findViewById(R.id.txtEnterNoSMS);
textSMS = (EditText) findViewById(R.id.txtMsgSMS);
buttonSend.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String phoneNo = textPhoneNo.getText().toString();
String sms = textSMS.getText().toString();
try {
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phoneNo, null, sms, null, null);
Toast.makeText(getApplicationContext(), "SMS Sent!", …Run Code Online (Sandbox Code Playgroud) 我正在尝试开发一个SMS计数器应用程序,其中我要计算当前日期的所有SMS。我不想计算收件箱中的短信总数。我正在使用以下代码,但未获得确切结果。它正在计算收件箱中的短信总数。
TextView视图=新的TextView(this);
Uri uriSMSURI = Uri.parse("content://sms/inbox");
Cursor cur = getContentResolver().query(uriSMSURI, null, null, null,null);
/*
int nsm = 0;
while(cur.moveToNext()){
nsm+= + cur.getCount();
}
*/
String sms = "";
while ( cur.moveToNext());{
// sms += "From :" + cur.getString(2) + " : " + cur.getString(11)+"\n";
// sms += cur.getString(2);
sms += "Total SMS in the INBOX : "+cur.getCount();
}
view.setText(sms);
setContentView(view);
Run Code Online (Sandbox Code Playgroud)
我是一个新学习者。提前致谢。
我想检查我的短信应用是否设置为android中的默认应用.我正在关注本教程:
http://android-developers.blogspot.com/2013/10/getting-your-sms-apps-ready-for-kitkat.html
我可以通过以下代码将我的短信应用设置为默认短信应用:
Intent intent = new Intent(context, Sms.Intents.ACTION_CHANGE_DEFAULT);
intent.putExtra(Sms.Intents.EXTRA_PACKAGE_NAME, context.getPackageName());
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
但我想检查我的短信应用是否设置为默认应用.我怎样才能做到这一点?
在我的应用程序中,我自动验证OTP.它的工作正常,直到牛轧糖.然后在奥利奥,它要求短信的运行时许可,但未授予许可.但是,如果我进入应用程序设置,然后给予许可,则自动读取短信.
这是oreo的问题还是我的代码中存在一些错误.
我想发送短信(文本或数据),接收方将根据我发送给他的具体网址打开网页浏览器.
我需要澄清一点,我不希望接收方在他身边有某种应用程序,它会收听传入短信的广播.我的意图是网页浏览器的Intent将根据我发送的网址打开,没有应用程序监听它,并且没有用户按下url快捷方式,他在文本消息中获取.
我的想法是,一旦收到(或打开)短信息消息,浏览器的意图就会自动打开.
如果这是可能的话,我会在每个答案中给出正确的方向.
谢谢你们.
在Registration过程中,我们需要Confirmation code通过SMS发送给用户.但我对此并不了解.我是新手.我不确定通过什么方法可以实现这一点.
任何人都可以指导我实施吗?喜欢引用任何SDKs或任何示例.
我通过我的申请向我的客户发送短信.假设如果向100个手机号码发送消息,则其中一个恰好是不存在的手机号码.我怎样才能单独跳过这个号码并发送其余的号码?当消息无法传递时,我在方法中使用try catch块,它会捕获并且无法发送其余的数字.有什么想法可以做到这一点?
HI I am getting this error when compiling in the beginning at SMS.Rest.Client. We are trying to use the Celltrust SMS server to facilitate messaging in our app. -------------------------END____________-
using Lda.Sms.Client.Events;
using Lda.Sms.Models;
using Caliburn.Micro;
using Newtonsoft.Json;
using RestSharp;
using RestSharp.Deserializers;
using RestSharp.Serializers;
using System;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
------------------------------
namespace Lda.Sms.Client.Services {
public class SmsRestClient : ISmsRestClient, IHandle<SuccessfulLoginEvent> {
private RestClient client = new RestClient();
string userId = null;
public SmsRestClient(IEventAggregator eventAggregator) {
eventAggregator.Subscribe(this);
var …Run Code Online (Sandbox Code Playgroud) sms ×12
android ×7
c# ×2
asp.net-mvc ×1
broadcast ×1
counter ×1
default ×1
emulation ×1
ios ×1
objective-c ×1