Home | 簡體中文 | 繁體中文 | 雜文 | 打賞(Donations) | Github | OSChina 博客 | 雲社區 | 雲棲社區 | Facebook | Linkedin | 知乎專欄 | Search | About

14.3. 

		
<uses-permission android:name="android.permission.SEND_SMS" />		
		
		
		
	private void sendSMS(String phoneNumber,String message){
        if(PhoneNumberUtils.isGlobalPhoneNumber(phoneNumber)){  
            Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:"+phoneNumber));            
            intent.putExtra("sms_body", message);            
            startActivity(intent);  
        }  
    }  		
		
		
		
	public void sendSMS(String phoneNumber,String message){  
        android.telephony.SmsManager smsManager = android.telephony.SmsManager.getDefault();  
        //拆分短信內容,手機短信長度有限制    
        List<String> divideContents = smsManager.divideMessage(message);   
        for (String text : divideContents) {    
            smsManager.sendTextMessage(phoneNumber, null, text, sentPI, deliverPI);    
        }  
    }