Baccega Andrea Blog

The future is web3.0

Posted on by veke87

I just figured out how to write an sms without sending it really on android froyo 2.2 using the content provider.

I'll write only the snippet here. Hope it helps

	 * writes an sms on the contentprovider
	 * @param ctx Context
	 * @param mobNo mobile number
	 * @param msg text of the message
	private final static void storeMessage(Context ctx,String mobNo, String msg) {
		ContentValues values = new ContentValues();
		values.put("address", mobNo);
		values.put("body", msg);
		ctx.getContentResolver().insert(Uri.parse("content://sms/sent"), values);

Obviously you should set the right permissions on the manifest ( Yes the following are all needed for this task ) :

	<uses-permission android:name="android.permission.WRITE_SMS"></uses-permission>
	<uses-permission android:name="android.permission.READ_SMS"></uses-permission>

Posted on by veke87 | Posted in Android | Tagged , , ,

  • Богдан Матвійчук

    how to udate sms ?

  • Mithun Raj G B

    How can I insert a new message to inbox and set it as new (unread) ?