use of com.moez.QKSMS.mmssms.Message in project qksms by moezbhatti.
the class HeadlessSmsSendService method onHandleIntent.
@Override
protected void onHandleIntent(Intent intent) {
String action = intent.getAction();
if (!TelephonyManager.ACTION_RESPOND_VIA_MESSAGE.equals(action)) {
return;
}
Bundle extras = intent.getExtras();
if (extras != null) {
String body = extras.getString(Intent.EXTRA_TEXT);
Uri intentUri = intent.getData();
String recipients = getRecipients(intentUri);
if (!TextUtils.isEmpty(recipients) && !TextUtils.isEmpty(body)) {
String[] destinations = TextUtils.split(recipients, ";");
Transaction sendTransaction = new Transaction(this, SmsHelper.getSendSettings(this));
Message message = new Message(body, destinations);
message.setType(Message.TYPE_SMSMMS);
sendTransaction.sendNewMessage(message, Transaction.NO_THREAD_ID);
NotificationManager.update(this);
}
}
}
use of com.moez.QKSMS.mmssms.Message in project qksms by moezbhatti.
the class PushbulletService method onMessageReceived.
@Override
protected void onMessageReceived(String conversationIden, String body) {
long threadId = Long.parseLong(conversationIden);
ConversationLegacy conversation = new ConversationLegacy(getApplicationContext(), threadId);
Transaction sendTransaction = new Transaction(getApplicationContext(), SmsHelper.getSendSettings(getApplicationContext()));
Message message = new com.moez.QKSMS.mmssms.Message(body, conversation.getAddress());
message.setType(com.moez.QKSMS.mmssms.Message.TYPE_SMSMMS);
sendTransaction.sendNewMessage(message, conversation.getThreadId());
QKReplyActivity.dismiss(conversation.getThreadId());
NotificationManager.update(getApplicationContext());
}
use of com.moez.QKSMS.mmssms.Message in project qksms by moezbhatti.
the class EndlessJabber method SendSMS.
@Override
public void SendSMS(Context context, String[] recipients, String body, boolean send) {
Log.d(TAG, "SendSMS");
Transaction sendTransaction = new Transaction(context, SmsHelper.getSendSettings(context));
Message message = new Message();
message.setType(com.moez.QKSMS.mmssms.Message.TYPE_SMSMMS);
message.setAddresses(recipients);
message.setText(body);
sendTransaction.sendNewMessage(message, 0);
}
use of com.moez.QKSMS.mmssms.Message in project qksms by moezbhatti.
the class EndlessJabber method SendMMS.
@Override
public void SendMMS(Context context, String[] recipients, MMSPart[] parts, String subject, boolean save, boolean send) {
Log.d(TAG, "SendMMS");
Transaction sendTransaction = new Transaction(context, SmsHelper.getSendSettings(context));
Message message = new Message();
message.setType(com.moez.QKSMS.mmssms.Message.TYPE_SMSMMS);
message.setAddresses(recipients);
message.setSubject(subject);
message.setSave(save);
sendTransaction.sendNewMessage(message, 0);
}
use of com.moez.QKSMS.mmssms.Message in project qksms by moezbhatti.
the class RemoteMessagingReceiver method onReceive.
@Override
public void onReceive(Context context, Intent intent) {
Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
Bundle bundle = intent.getExtras();
if (remoteInput != null && bundle != null) {
if (intent.getAction().equals(ACTION_REPLY)) {
Message message = new Message(remoteInput.getCharSequence(EXTRA_VOICE_REPLY).toString(), new String[] { bundle.getString(EXTRA_ADDRESS) });
Transaction sendTransaction = new Transaction(context, SmsHelper.getSendSettings(context));
sendTransaction.sendNewMessage(message, bundle.getLong(EXTRA_THREAD_ID));
Intent i = new Intent(context, MarkReadService.class);
i.putExtra(EXTRA_THREAD_ID, bundle.getLong(EXTRA_THREAD_ID));
context.startService(i);
}
}
}
Aggregations