in the Manifest:
<uses-permission android:name="android.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.READ_SMS"/>
void readSMS(){
TextView view = new TextView(this);
Uri uriSMSURI = Uri.parse("content://sms/inbox");
Cursor cur = getContentResolver().query(uriSMSURI, null, null, null,null);
String sms = "";
String sms1 = "";
while (cur.moveToNext()) {
for(int c=0;c<cur.getColumnCount();c++){
if(cur.getColumnName(c).equalsIgnoreCase("_id"))
sms += "ID :" + cur.getString(c)+"\n";
if(cur.getColumnName(c).equalsIgnoreCase("date"))
sms += "Date :" + cur.getLong(c)+"\n";
if(cur.getColumnName(c).equalsIgnoreCase("address"))
sms += "Address :" + cur.getString(c)+"\n";
if(cur.getColumnName(c).equalsIgnoreCase("body"))
sms += "Body :" + cur.getString(c)+"\n";
sms1 +=c+". "+ cur.getColumnName(c)+":" + cur.getString(c) +"\n";
}
sms += "\n";
//sms += "From :" + cur.getString(2) + " : " + cur.getString(12)+"\n";
}
Log.d(TAG, sms);
Log.d(TAG, sms1);
view.setText(sms);
setContentView(view);
}
void sendSMS(){
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage("+39XXXXXXXXXX", null, "sms message", null, null);
}
/**
* Make a phone call
*/
<uses-permission android:name="android.permission.CALL_PHONE"/>
void makeCall(){
new Thread(){
public void run(){
Intent it1 = new Intent(Intent.ACTION_CALL, Uri.parse("tel:155"));
it1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(it1);
//Intent it = new Intent(Intent.ACTION_CALL, Uri.parse("tel:3xxxxxx"));
//it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//startActivity(it);
//It's necessary to stop the call after a while
}
}.start();
}