-1
我正在嘗試發短信發送應用,但短信沒有發送。請指導。短信不發送
package com.example.smsbomber;
import android.R.string;
import android.app.Activity;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.view.Menu;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
sendLongSMS();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
public void sendLongSMS() {
String phone ="03322044685";
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phone, null, "Message", null, null);
}
}
你有'<使用許可權的android:NAME =「android.permission.SEND_SMS」 />'在'AndroidManifest.xml'和你想從一個仿真器或一個真正的手機發送? – Darwind