Android SmsManager - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android SmsManager class.

This code example shows how to use the following methods: sendTextMessage
	} 
	 
	@Test 
	public void shouldStoreLastSentTextMessageParameters() { 
		 
		smsManager.sendTextMessage(testDestinationAddress, testScAddress, testText, null, null);
		 
		ShadowSmsManager.TextSmsParams lastParams = shadowSmsManager.getLastSentTextMessageParams();
		 
		Assert.assertEquals(testDestinationAddress, lastParams.getDestinationAddress());
		Assert.assertEquals(testScAddress, lastParams.getScAddress());
		Assert.assertEquals(testText, lastParams.getText());
	} 
 
    @Test 
    public void shouldClearLastSentTestMessageParameters() { 
        smsManager.sendTextMessage(testDestinationAddress, testScAddress, testText, null, null);
        shadowSmsManager.clearLastSentTextMessageParams();
        Assert.assertNull(shadowSmsManager.getLastSentTextMessageParams());
    } 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: divideMessage, sendMultipartTextMessage
		 
		if (mSMSManager == null) {
			return (false); 
		} 
 
		mFragmentList = mSMSManager.divideMessage(aMessageText);
		int fragmentCount = mFragmentList.size();
		if (fragmentCount > 1) {
			Log.d(TAG, "Sending " + fragmentCount + " parts");
			mSMSManager.sendMultipartTextMessage(aDestinationAddress, 
					mServiceCentreAddr,
					mFragmentList, null, null);
		} else { 
			Log.d(TAG, "Sendine one part");
			mSMSManager.sendTextMessage(aDestinationAddress, 
					mServiceCentreAddr,
					aMessageText, null, null);
		} 
 
		return true; 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: sendTextMessage
				Toast.makeText(this,"Message is longer then allowed in SMS",Toast.LENGTH_LONG).show();
			} else{ 
				PendingIntent piSend = PendingIntent.getBroadcast(this, 0, new Intent(SMS_SENT),0);
				PendingIntent piDelivered = PendingIntent.getBroadcast(this, 0, new Intent(SMS_DELIVERED), 0);
 
				manager.sendTextMessage(number, null, message, piSend, piDelivered);
				etMessage.setText("");
			} 
		} 
	} 
 
	@Override 
	protected void onResume() { 
		registerReceiver(outgoingSMSBR, new IntentFilter(SMS_SENT));
 
		registerReceiver(deliverSMSBR, new IntentFilter(SMS_DELIVERED));
 
		super.onResume(); 
	} 
 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: divideMessage, sendTextMessage, getClass
		aclass[8] = Integer.TYPE;
 
		Method method;
 
		try { 
			method = smsManager.getClass().getMethod("sendMultipartTextMessage", aclass);
 
			Object aobj[] = new Object[9];
			aobj[0] = phoneNumber;
			aobj[1] = null;
			aobj[2] = smsManager.divideMessage(message);
			aobj[3] = sendIntents;
			aobj[4] = deIntents;
			aobj[5] = Boolean.valueOf(false);
			aobj[6] = Integer.valueOf(0);
			aobj[7] = Integer.valueOf(0);
			aobj[8] = Integer.valueOf(0);
 
			method.invoke(smsManager, aobj);
 

5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: divideMessage, sendTextMessage, getClass
		aclass[8] = Integer.TYPE;
 
		Method method;
 
		try { 
			method = smsManager.getClass().getMethod("sendMultipartTextMessage", aclass);
 
			Object aobj[] = new Object[9];
			aobj[0] = phoneNumber;
			aobj[1] = null;
			aobj[2] = smsManager.divideMessage(message);
			aobj[3] = sendIntents;
			aobj[4] = deIntents;
			aobj[5] = Boolean.valueOf(false);
			aobj[6] = Integer.valueOf(0);
			aobj[7] = Integer.valueOf(0);
			aobj[8] = Integer.valueOf(0);
 
			method.invoke(smsManager, aobj);
 

5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android SmsManager Questions & Answers:

See Code Examples for Android SmsManager Methods: