Search in sources :

Example 1 with Message

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);
        }
    }
}
Also used : Transaction(com.moez.QKSMS.mmssms.Transaction) Message(com.moez.QKSMS.mmssms.Message) Bundle(android.os.Bundle) Uri(android.net.Uri)

Example 2 with Message

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());
}
Also used : ConversationLegacy(com.moez.QKSMS.data.ConversationLegacy) Transaction(com.moez.QKSMS.mmssms.Transaction) Message(com.moez.QKSMS.mmssms.Message)

Example 3 with Message

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);
}
Also used : Transaction(com.moez.QKSMS.mmssms.Transaction) Message(com.moez.QKSMS.mmssms.Message)

Example 4 with Message

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);
}
Also used : Transaction(com.moez.QKSMS.mmssms.Transaction) Message(com.moez.QKSMS.mmssms.Message)

Example 5 with Message

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);
        }
    }
}
Also used : Message(com.moez.QKSMS.mmssms.Message) Transaction(com.moez.QKSMS.mmssms.Transaction) Bundle(android.os.Bundle) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent)

Aggregations

Message (com.moez.QKSMS.mmssms.Message)6 Transaction (com.moez.QKSMS.mmssms.Transaction)6 Bundle (android.os.Bundle)2 PendingIntent (android.app.PendingIntent)1 Intent (android.content.Intent)1 Uri (android.net.Uri)1 ConversationLegacy (com.moez.QKSMS.data.ConversationLegacy)1