package com.example.smsfake;


import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Toast;
/**
 * http://www.freebuf.com/articles/terminal/33127.html
 *零权限发送短信,支持android4.0以下版本
4.0以上：Caused by: java.lang.SecurityException: Not allowed to start service Intent 
{ act=android.provider.Telephony.SMS_RECEIVED cmp=com.android.mms/.transaction.SmsReceiverService (has extras) }
 without permission not exported from uid 10017
*/

public class MainActivity extends Activity {

	private static final String TAG = "MainActivity";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
	}

	@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 smsFake(View view) {

		Log.d(TAG, "smsFake");
		Toast.makeText(this, "smsFake", Toast.LENGTH_LONG).show();
		SmsUtil.createFakeSms(this, "10086", "恭喜你，你已经欠费停机，有问题请咨询10086。");
		Toast.makeText(this, "ok", Toast.LENGTH_LONG).show();
		Log.d(TAG, "smsFake finish");

	}
}
