发送短信我在下面写了代码:
package com.sendsms;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class SendsmsActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button new_btn = (Button)findViewById(R.id.send_btn);
new_btn.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage("+8615959762862", null, "i love you", null, null);
}
});
}
}
筹码:
ISms$Stub$Proxy.sendText(String, String, String, PendingIntent, PendingIntent) line: 443
SmsManager.sendTextMessage(String, String, String, PendingIntent, PendingIntent) line: 87
SendsmsActivity$1.onClick(View) line: 23
Button(View).performClick() line: 2408
答案 0 :(得分:6)
确定你宣布
<uses-permission android:name="android.permission.SEND_SMS"></uses-permission>
在你的清单中