Skip to content
Archi23 edited this page Jun 16, 2019 · 1 revision

# SMS2Call

Aktualności:

v1.7.1 New ListView added

v1.6 Visual corrections

v1.5 The option of selecting the type of information in the connection log has been added

v1.4 Information about the privacy policy has been added with the necessity of giving consent

v1.3 The application is intended for service providers who use telephone connections (many) in contact with customers with feedback via SMS. SMS2Call allows you to send a standardized SMS to the clinics you talked to.

Application purpose

The application has been designed to be used in contacts with clients (CRM). The main function of the application is to read the callers from telephone calls and send a standardized SMS to it in accordance with the assumptions of your company.

The SMS you prepare can inform about all aspects related to the company's business activities, for example, ask for the address in which the service service is to be made, inform the customer about the method of carrying out service tasks, etc.

The application does not store any data related to the read list of telephone connections (it only reads them for the purpose of sending an SMS) and does not store information about sent SMS (the more does not read the SMS archive). You can view all sent SMS in the default SMS application. Further conversation can be done using the default SMS application.

The SMS2Call application helps your service company in the first contact when you have to ask the customer constantly for the same information. You do not have to prepare the same SMS and write it every time. SMS2Call allows you to create one model SMS for a contact with the client and use it at every contact of a new customer or another service for the client that he wants to order.

Usually on Android, the user would have to do the following:

  • Answer the phone call,
  • Find the connection in the connection register,
  • Once the connection has been found, select the contact information function
  • Select sending SMSs,
  • Write an SMS to the recipient's address

The application simplifies these procedures to click the last number call and that's all.

Main code examples:

Downloading information from the register of connections:

Cursor managedCursor;

    `switch ((String) ZmienneGlobalne.getInstance().global_var[5]) {`

        `case "Incoming":`
            `managedCursor = getContentResolver().query(`
                    `CallLog.Calls.CONTENT_URI, null, CallLog.Calls.TYPE   "="   CallLog.Calls.INCOMING_TYPE, null, CallLog.Calls.DATE   " DESC");`
            `break;`
        `case "Outgoing":`
            `managedCursor = getContentResolver().query(`
                    `CallLog.Calls.CONTENT_URI, null, CallLog.Calls.TYPE   "="   CallLog.Calls.OUTGOING_TYPE, null, CallLog.Calls.DATE   " DESC");`
            `break;`
        `case "All":`
            `managedCursor = getContentResolver().query(`
                    `CallLog.Calls.CONTENT_URI, null, null, null, CallLog.Calls.DATE   " DESC");`
            `break;`
        `default:`
            `managedCursor = getContentResolver().query(`
                    `CallLog.Calls.CONTENT_URI, null, CallLog.Calls.TYPE   "="   CallLog.Calls.INCOMING_TYPE, null, CallLog.Calls.DATE   " DESC");`
    `}`

    `int number = managedCursor.getColumnIndex(CallLog.Calls.NUMBER);`
    `int date = managedCursor.getColumnIndex(CallLog.Calls.DATE);`
    `int type = managedCursor.getColumnIndex(CallLog.Calls.TYPE);`
    `int licznik = 0;`


    `if (managedCursor.getCount() >= 1) {`
        `while (managedCursor.moveToNext()) {`
            `if (licznik == iloscWLiscie) {`
                `break;`
            `}`
            `String phNumber = managedCursor.getString(number);`
            `String callDate = managedCursor.getString(date);`
            `String callType = managedCursor.getString(type);`
            `String txtType = "";`
            `android.text.format.DateFormat df = new android.text.format.DateFormat();`
            `Date callDayTime = new Date(Long.valueOf(callDate));`

            `switch (callType){`
                `case "1":`
                    `txtType = "Incoming";`
                    `image = R.drawable.incoming;`
                    `break;`
                `case "2":`
                    `txtType = "Outgoing";`
                    `image = R.drawable.outcoming;`
                    `break;`
                `case "3":`
                    `txtType = "Missed";`
                    `image = R.drawable.missed;`
                    `break;`
                `case "4":`
                    `txtType = "VoiceMail";`
                    `image = R.drawable.voicemail;`
                    `break;`
                `case "5":`
                    `txtType = "Rejected";`
                    `image = R.drawable.reject;`
                    `break;`
                `case "6":`
                    `txtType = "Blocked";`
                    `image = R.drawable.block;`
                    `break;`
                `case "7":`
                    `txtType = "Answered Externally";`
                    `image = R.drawable.ans_ext;`
                    `break;`
                `default:`
                    `txtType = "Other: "   callType;`


            `}`
            `licznik = licznik   1;`

            `HashMap map = new HashMap();`
            `// adding each child node to HashMap key => value`
            `map.put("id", phNumber);`
            `map.put("tel", phNumber);`
            `map.put("list_image",image.toString());`
            `map.put(TAG_LINIA1, df.format("dd-MM-yyyy HH:mm:ss", callDayTime).toString());`
            `map.put(TAG_LINIA2, txtType);`


            `// adding HashList to ArrayList`
            `productsList.add(map);`
        `}`
    `}`
    `managedCursor.close();`

Sending an SMS message:

ArrayList sentPendingIntents = new ArrayList(); ArrayList deliveredPendingIntents = new ArrayList();

PendingIntent sentPI = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(getApplicationContext(), SmsSentReceiver.class), 0);

PendingIntent deliveredPI = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(getApplicationContext(), SmsDeliveredReceiver.class), 0);

try { SmsManager sms = SmsManager.getDefault(); ArrayList parts = sms.divideMessage(message); for (int i = 0; i < parts.size(); i ) { sentPendingIntents.add(i, sentPI); deliveredPendingIntents.add(i, deliveredPI); } sms.sendMultipartTextMessage(phoneNumber, null, parts, sentPendingIntents, deliveredPendingIntents ); } catch (Exception e){ e.printStackTrace(); Toast.makeText(getBaseContext(), "SMS sending failed...", Toast.LENGTH_SHORT).show(); }

Supports SMS delivery

public void onReceive(Context context, Intent arg1) { switch (getResultCode()) { case Activity.RESULT_OK: if (ZmienneGlobalne.getInstance().global_var[3] == "1") { Toast.makeText(context, "SMS delivered", Toast.LENGTH_SHORT).show(); } break; case Activity.RESULT_CANCELED: if (ZmienneGlobalne.getInstance().global_var[3] == "1") { Toast.makeText(context, "SMS not delivered", Toast.LENGTH_SHORT).show(); } break; } }

Privacy policy: The application uses the function of reading the phone call register and the function of sending SMS. The connection data is only read and is not saved in any form in the application. The application uses the register of incoming connections for the purpose of sending an SMS. The SMS content is configurable in the application settings. If you agree to use the read function of the connection book and send from the SMS application, select the OK button. If you do not agree, select the CANCEL button and the application will be closed.

Clone this wiki locally