開啟簡訊權限

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

 

發簡訊的函式如下。

public void sendSMS(String USER_SEND_MESSAGE,String TARGET_PHONE_NUMBER){
	SmsManager smsManager = SmsManager.getDefault();

	try{
		smsManager.sendTextMessage(TARGET_PHONE_NUMBER,
				null,
				USER_SEND_MESSAGE ,
				PendingIntent.getBroadcast(getApplicationContext(),	0,new Intent(), 0),null);
		Toast.makeText(this,"Send",Toast.LENGTH_SHORT).show();
	}
	catch(Exception e){
		Toast.makeText(this,"Send Error",Toast.LENGTH_SHORT).show();
	}
}

 

arrow
arrow
    文章標籤
    Android
    全站熱搜

    Lung-Yu,Tsai 發表在 痞客邦 留言(0) 人氣()