Introduction: CellC Usage Widget for Android

I've created this instructable specifically for CellC (cellphone network) users in South Africa. Even if you are not on CellC or even in South Africa, you can still benefit from this if you get an SMS with your totals/available time/etc.

The reason for this is that there is no widget that displays the remaining talk-time, sms or data infmormation on the phone's desktop.

Before I begin, there are a LOT of steps in this, so I've broken it down into bit-sized chunks, I've kept the step number though so if you take a break 1/2 way though, you'll still be able to find where you left off quite easily.

You do NOT need root to get this working.

What you need:

  • Phone running Android (Root NOT required)
  • Be using the CellC network.
  • Tasker - About R33 or so ($2.99)
  • Minimalistic Text (I refer to it as MT from hereon out) - FREE but if you like it, you can use the "Donate version" which is about R22 ($2.05). Totally worth it!

What you'll end up with: A 1x1 widget that displays the following information:

  • Available Talk-time in Hours:Minutes:Seconds
  • Remaining SMS/MMS
  • Remaining Data
  • Expected extra charge
  • Your Usage in Rands this cycle
  • Expected payment date

Additionally, when you double-tap on the widget, it'll get the latest details and update the widget.
Ok, before we start, the very first thing you need to do is add a new contact to your phone book. The number will be +27840001341 and the contact name should be "CellCAccountBalance".

DISCLAIMER!: I'm pretty certain that this SMS is free, but I haven't tested it on your phone. Nor have I contacted CellC to verify that it is free. Maybe that should be the first thing you do. Give them a shout and ask if there are any costs involved.

Step 1: Tasker - Part 1

Whenever I say Enter "this text" somewhere, do NOT enter the quote marks as well, unless I say so (I won't).
Ok, lets get started!

  1. In Tasker, lets go ahead and click on Tasks to set up the 2 tasks that we'll need:
  2. Tap on the + at the bottom of the screen.
  3. Enter the name "Send SMS to get balance" - Don't worry, these SMSs are free.
  4. Tap on the check mark to open the new empty task.
  5. In the new empty task tap on the + to add an action.
  6. Tap on "Phone". Tap on "Send SMS" Under Recipient(s) enter "14302"
  7. Under Message enter "Balance"
  8. Tap on the Tasker icon in the top left of the screen to go back to the task.
  9. Tap on the Tasker icon AGAIN in the top left of the screen to go back to the task list.

Running that task as is will send an SMS, and the reply SMS will have the details in it. You can stop here if you want, but I reckon keep going, it's totally worth it

Step 2: Tasker - Part 2

10: Tap on the + at the bottom of the screen to add another action.
11: Let's call this one "Read SMS"
12: Tap on the check mark to open the new empty task.
13: In the new empty task tap on the + to add an action.
14: Tap on "Variables"
15: Tap on "Variable Search Replace" (You might only see "Variable Search...")
16: Under Variable enter "%SMSRB"
17: This is the painful one. Under Search, enter the following line exactly as it is case sensitivity is VERY important:

(\d\d:\d\d:\d\d)|(\d+(?=\.D))\d*+|(\d\d/\d\d/\d{4})|(\d+\.\d{2})

18: Under Store Matches In, enter "%cellusage"
19: Tap on the Tasker icon in the top left of the screen to go back to the task.

Step 3: Tasker - Part 3

We'll be repeating the next few steps a few (6) times entering slightly different information

1

20: Tap on the + to add an action.
21: Tap on "Plugin"
22: Tap on "Minimalistic Text"
23: Next to Configuration, click on the Pencil icon to edit it.
24: Next to Variable name, enter "%timeleft"
25: Next to Variable content, enter "%cellusage(1)"
26: You may have to close your keyboard to tap on "OK"
27: Tap on the Tasker icon in the top left of the screen to go back to the task.

2 - I'll Bold only the differences in the rest

28: Tap on the + to add an action.
29: Tap on "Plugin"
30: Tap on "Minimalistic Text"
31: Next to Configuration, click on the Pencil icon to edit it.
32: Next to Variable name, enter "%smsleft"
33: Next to Variable content, enter "%cellusage(2)"
34: Tap on "OK"
35: Tap on the Tasker icon in the top left of the screen to go back to the task.

3

36: Tap on the + to add an action.
37: Tap on "Plugin"
38: Tap on "Minimalistic Text"
39: Next to Configuration, click on the Pencil icon to edit it.
40: Next to Variable name, enter "%mbleft"
41: Next to Variable content, enter "%cellusage(3)"
42: Tap on "OK"
43: Tap on the Tasker icon in the top left of the screen to go back to the task.

4

44: Tap on the + to add an action.
45: Tap on "Plugin"
46: Tap on "Minimalistic Text"
47: Next to Configuration, click on the Pencil icon to edit it.
48: Next to Variable name, enter "%callcost"
49: Next to Variable content, enter "%cellusage(4)"
50: Tap on "OK"
51: Tap on the Tasker icon in the top left of the screen to go back to the task.

5

52: Tap on the + to add an action.
53: Tap on "Plugin"
54: Tap on "Minimalistic Text"
55: Next to Configuration, click on the Pencil icon to edit it.
56: Next to Variable name, enter "%nextbill"
57: Next to Variable content, enter "%cellusage(5)"
58: Tap on "OK"
59: Tap on the Tasker icon in the top left of the screen to go back to the task.

6

60: Tap on the + to add an action.
61: Tap on "Plugin" 62: Tap on "Minimalistic Text"
63: Next to Configuration, click on the Pencil icon to edit it.
64: Next to Variable name, enter "%duedate"
65: Next to Variable content, enter "%cellusage(6)"
66: Tap on "OK"
67: Tap on the Tasker icon in the top left of the screen to go back to the task.
68: Tap on the Tasker icon in the top left of the screen to go back to the tasks list.

Phew!

Step 4: Tasker - Part 4

69: Tap on Profiles near the top of the screen
70: Tap on the "+"
71: Tap on "Event"
72: Tap on "Phone"
73: Tap on "Received Text"
74: Under Type, change "Any" to "SMS"
75: Next to Sender, click on the Search magnifying glass
76: Tap on "A Single Contact"
77: Scroll down to find that contact that we created before we started "CellCAccountBalance" and tap on it.
78: Tap on the Tasker icon in the top left of the screen to go back to the profiles list, A list of Tasks you have created will pop up.
79: Tap on the "Read SMS" task.

Step 5: Minimalistic Text - Part 1

80: Now different phones differ here. For most of the newer ones, you long-press on the screen to add a widget and then drag the widget you want onto the desktop. If you use a different method then do it that way. The widget we're looking for is the "Minimalistic Text (1x1)".

Once the widget is placed it will automatically open up the MT settings.

81: At the top where is says "Background", scroll to the right until you find "Layout"
82: Tap on "Layout"
83: Lets go ahead and remove the existing item there by tapping on the 3 vertically aligned dots on the right and select "Delete Now"

Step 6: Minimalistic Text - Part 2

OK, we're going to be repeating ourselves again, you know the drill.

1

84: On the bottom left, tap on the fat "+".
85: At the top (where it says Battery, Date, etc...) scroll to the right to find "Misc" and tap on it.
86: Tap on the little square next to "Static Text" (It'll automatically put 2 checks in the boxes).
87: Tap on the little square next to "Locale Variable" (It'll automatically put 2 checks in the boxes).
88: Tap on "OK"
89: Now tap on the button that reads "Static text"
90: In the popup next to "Static text" enter "Time:"
91: Tap on "OK"
92: Now tap on the button that reads "Locale Variable"
93: In the popup next to "Variable name" enter "%timeleft"
94: Change the "Style" to "Accented"
95: Tap on "OK"

2 - only changes are bolded for you

96: On the bottom left, tap on the fat "+".
97: At the top scroll to the right to find "Misc" and tap on it.
98: Tap on the little square next to "Static Text"
99: Tap on the little square next to "Locale Variable"
100: Tap on "OK"
101: Now tap on the button that reads "Static text"
102: In the popup next to "Static text" enter "SMS:"
103: Tap on "OK"
104: Now tap on the button that reads "Locale Variable"
105: In the popup next to "Variable name" enter "%smsleft"
106: Change the "Style" to "Accented"
107: Tap on "OK"

3

108: On the bottom left, tap on the fat "+".
109: At the top scroll to the right to find "Misc" and tap on it.
110: Tap on the little square next to "Static Text"
111: Tap on the little square next to "Locale Variable"
112: Tap on "OK"
113: Now tap on the button that reads "Static text"
114: In the popup next to "Static text" enter "Data:"
115: Tap on "OK"
116: Now tap on the button that reads "Locale Variable"
117: In the popup next to "Variable name" enter "%mbleft"
118: Change the "Style" to "Accented"
119: Tap on "OK"

4

120: On the bottom left, tap on the fat "+".
121: At the top scroll to the right to find "Misc" and tap on it.
122: Tap on the little square next to "Static Text"
123: Tap on the little square next to "Locale Variable"
124: Tap on "OK"
125: Now tap on the button that reads "Static text"
126: In the popup next to "Static text" enter "Charge:"
127: Tap on "OK"
128: Now tap on the button that reads "Locale Variable"
129: In the popup next to "Variable name" enter "%callcost"
130: Change the "Style" to "Accented"
131: Tap on "OK"

5

132: On the bottom left, tap on the fat "+".
133: At the top scroll to the right to find "Misc" and tap on it.
134: Tap on the little square next to "Static Text"
135: Tap on the little square next to "Locale Variable"
136: Tap on "OK"
137: Now tap on the button that reads "Static text"
138: In the popup next to "Static text" enter "Bill:"
139: Tap on "OK"
140: Now tap on the button that reads "Locale Variable"
141: In the popup next to "Variable name" enter "%nextbill"
142: Change the "Style" to "Accented"
143: Tap on "OK"

6 - Slightly different here - we're not adding a Static Text

144: On the bottom left, tap on the fat "+".
145: At the top scroll to the right to find "Misc" and tap on it.
146: Tap on the little square next to "Locale Variable".
147: Tap on "OK"
148: Now tap on the button that reads "Locale Variable"
149: In the popup next to "Variable name" enter "%duedate"
150: Change the "Style" to "Accented"
151: Tap on "OK"

As it is now, it will work, but not work as well as it should! not much more to do now.

Step 7: Minimalistic Text - Part 3

152: At the top (where it says Battery, Date, etc...) scroll to the right to find "Double-Tap Behaviour" and tap on it.
153: Make sure that the 1st option ("Disable special action on Double-Tap") is NOT checked.
154: Tap on "Start Another Activity".
155: Tap on "Select an activity or a shortcut"
156: At the top of the list that pops up, tap on "Shortcuts"
157: Scroll down to Tasker and tap on it.
158: Tap on the area below Tasker that has now opened up.
159: Tap on "Send SMS to get Balance"
160: It will open up the task in tasker. Tap on the icon in the bottom right
161: Tap on "Built-In Icon"
162: Select any icon from the list (I picked the one that looks like a little letter on it's corner).
163: Tap back on your phone
164: Tap back on your phone again and tap on "Yes"

And that's it! WELL DONE!
Now go find the widget you created, and double-tap on it. It might (depending on what version of Android you're running) warn you that Tasker would like to send an SMS that might cost you money. You can check the little box and the click on "Send". This is a free service offered by CellC, so it won't cost you anything - not even an SMS.

Now wait a few moments while CellC sends you a response SMS that will populate the fields in the MT widget.

You can also spend a bit of time in MT customizing the way the widget looks by changing the text colours and by changing font sizes etc.

If you like that nice little blue colour that MT uses in their "Accented" style, and want to match it... the HEX code for it is "FF7DB5CF".

Wait! What was that? you wanted some extra functionality? OK!

Step 8: Bonus - Part 1

165: In Tasker, go to Profiles, and tap that "+" at the bottom.
166: Tap on "Time"
167: Change both times to 09:00 and make sure that "Repeat" is unchecked.
168: Tap on the Tasker icon in the top left of the screen to go back to the profiles list, A list of Tasks you have created will pop up.
169: Tap on "Send SMS...t Balance" (It'll have the little icon that you selected earlier next to it.)

Excellent, now each morning, your widget will be updated.

Step 9: Bonus - Part 2

More? You want MORE? Come on! Give me a break... OK... just one more for now.

170: Go on, tap that "+" at the bottom again.
171: This time, tap on "Event"
172: Then tap on "Phone"
173: Then tap on "Phone Idle"
174: Yeah, it's a blank screen. Go ahead and tap on the Tasker icon in the top left of the screen to go back to the profiles list, A list of Tasks you have created will pop up.
175: Tap on the Tasker icon in the top left of the screen to go back to the profiles list, A list of Tasks you have created will pop up.
176: Tap on "Send SMS...t Balance" (It'll have the little icon that you selected earlier next to it.)

Now, each time you end a call, the widget will be updated as well.

That's it I'm done.

If you find any errors in this walk-through, please let me know, I'll patch it right up. Also PLEASE let me know if you liked it and if you followed my instructions. Let me know what you think of your new widget!

Hopefully you'll have learned some things by now - basic Tasker usage and basic Minimalist Text usage. I encourage (and challenge) you to improve on my design and come up with some interesting ways of displaying your text.

The one thing in here that would be a bit more of a challenge would be the Regex (step 17). Although, there are plenty of useful sites on the net that will help you build your own..

Comments

author
Jim Sher (author)2014-07-21

Tasker does not let you capture and use USSD codes (that's why i didn't go that route), nor does it let you mark SMS as read or delete SMSs. (well it does, but you have to get VERY technical with SQLite (which I'm not prepared to do)... So, I've created a bit of a dirty cheat. to get rid of the SMS notification in the notification bar.

Before you proceed, you will require root to do this (which is why I did not include it in the instructable).

Using an SMS detection profile that picks up that an SMS has been received from "CellCAccountBalance", it runs a task that (1) opens messaging (the SMS handling app on my phone) and in so doing removes the notification from the notification bar, (2) waits 300ms for it to finish opening, and then (3) uses root to close messaging. Without root, it will not close, and having your SMS app open every time you get up update would suck.

At least most of the time when the widget updates, I'm not looking at my phone, so it doesn't really bother me.

author
Hark3n (author)2014-07-21

Wow, just wow. Really detailed. Will definitely be trying it out. Thanks boet.

author
Jim Sher (author)Hark3n2014-07-22

Keen to see your screenshot.