[GUIDE][Difficulty: Intermediate] Monitor Monthly Call/Data Usage

Search This thread

MishaalRahman

Retired Editor in Chief
Nov 2, 2015
1,045
2,153
www.xda-developers.com
If you're not using an unlimited minutes/data plan, then you might be finding yourself monitoring your usage so you can stop yourself from incurring significant overages on your account. You can use a third-party widget or get notified from your carrier's app (if such a feature exists) but the disadvantages of these are a) the theming abilities of these widgets are limited or b) your carrier's app isn't all that great.

Using Tasker, AutoInput, and USSD codes you can easily grab this data and manipulate it however you want. In my tutorial, I will be grabbing the minutes/data used from T-Mobile USA and incorporate it into a Zooper Widget.

Prerequisites

  1. AutoInput to query the text on the toast input.
  2. USSD codes you can run that will provide you with the remaining minutes/data left in your account. You will have to look these up for your carrier.
  3. OPTIONAL: Zooper Widget, for displaying the minutes/data in the form of a progress bar.

I'm not defining any contexts here for you, but you can set these tasks up to run on whatever trigger you want. For instance, for me I have these two tasks run every night at 1am to update my Zooper Widgets.

Instructions

  • Run the USSD code you want to automatically grab at least one time manually in the phone app. Take a screenshot or write down the text used for reference. It's less than 160 chars since it's an SMS, so don't complain about having to write ;) (You could use Flash action to show what the output is, that's up to you though)
    re6zFTb.jpg
  • Create a task and call it "Call Usage."
  • Phone --> Call. Set the Number to the USSD code that will return how many minutes you have left. For me on T-Mobile USA this is #646#. Check "Auto Dial."
  • Plugin --> AutoInput UI Query. Check "Only Visible" and go down to "Text" and put in some unique, recurring text from the USSD code pop-up that AutoInput will wait to see before querying the screen. For me, I used "Addl minutes are charged" because I'm on a pre-paid plan.
  • Plugin --> AutoInput Action. This one is a bit wonky to set up, but basically you'll want to have AutoInput ready to record your tap input while the USSD is already on screen. To do this I would recommend setting a wait function before running the USSD code, then quickly going to AutoInput and starting the record input function. Once the USSD code is on screen, you can record the input. Optionally, you can use an input tap to have it tap anywhere on the screen to dismiss it.
  • Variables --> Variable Split. Split %aitext(1) in an attempt to isolate the amount of remaining minutes you have. For me, I set the Splitter to "You have"
  • Variables --> Variable Split. Split %aitext12 to fully isolate the number value of the remaining minutes. Here, I did "included minutes" as the Splitter.
  • Variables --> Variable Set. Set Name to %calltotal and set it To your total minutes minur %aitext121. Check "Do Math". This will determine how many minutes you have actually used.
  • (OPTIONAL): Plugin --> Zooper Widget Pro Variable. Set #TCALLUSAGE# (which should be written as CALLUSAGE within the ZW configuration, but is presented to ZW as variable #TCALLUSAGE#) to %calltotal. Now you can display this variable as a part of any Zooper Widget you like!

AzSywx9.jpg

  1. Create a new task called "Data Usage."
  2. Phone --> Call. Number is the USSD code that tells you the data remaining in your plan. For me on T-Mobile USA it's #932#. Again, set it to "Auto Dial."
  3. Plugin --> AutoInput UI Query. Again, like before, click on "Only Visible" and for Text set something unique from the USSD code pop-up that will make AutoInput query the screen when the text pops up.
  4. Plugin --> AutoInput Action. Do the same as before, hell, you can even copy/paste the same action from the previous task to dismiss the pop-up!
  5. Variables --> Variable Split. Split %aitext(1) to isolate the amount of data used. For me, I put "You have used" as the splitter.
  6. Variables --> Variable Split. Split %aitext12 using the splitter to separate the number and its data unit. For me, I set it to "MB"
  7. Variables --> Variable Set. Set Name to %datamb and set it to ceil(%aitext121). This will round-up the data usage to the nearest whole number, so it will display properly in Zooper Widget.
  8. (OPTIONAL): Plugin --> Zooper Widget Pro Variable. Set #TDATAUSAGE# to %datamb. Same idea as before.

TjXiHa4.jpg


Finally, here's what my Zooper Widget looks like (along with my config). My usage had just reset recently so you can't really see much of the progress, though:

iVjGsGf.jpg


uxgG359.jpg
 

Attachments

  • Call_Usage.tsk.xml
    8.3 KB · Views: 488
  • Data_Usage.tsk.xml
    9.1 KB · Views: 632
Last edited:

TeriusPR

Senior Member
Jul 13, 2015
111
4
San Juan
When I run the task it shows me this error and how or where do you make the or find the widget?
 

Attachments

  • Screenshot_20160308-230230.jpg
    Screenshot_20160308-230230.jpg
    237.5 KB · Views: 523

MishaalRahman

Retired Editor in Chief
Nov 2, 2015
1,045
2,153
www.xda-developers.com
When I run the task it shows me this error and how or where do you make the or find the widget?

Can you provide a screenshot of the pop-up that shows up when you enter the USSD code? As for the widget, you would have to download Zooper Widget from the Play Store, then create a "Progress Bar" widget and for the number put in the variable that Tasker is setting, as shown in my screenshot. For the min put 0 and for the max put your data limit (for me, it's 5000MB)
 

TeriusPR

Senior Member
Jul 13, 2015
111
4
San Juan
This is the only popup, and then I receive a text message with all the data usage's numbers.
 

Attachments

  • Screenshot_20160308-231942.png
    Screenshot_20160308-231942.png
    244 KB · Views: 483

MishaalRahman

Retired Editor in Chief
Nov 2, 2015
1,045
2,153
www.xda-developers.com
This is the only popup, and then I receive a text message with all the data usage's numbers.

Since your carrier is sending you text messages, you will have to intercept the text message content in order to get the data you want. My profile won't work for that, but luckily intercepting text message content is rather simple.

Simply create an Event, go to Phone --> Received Text. For the Sender, set it to the carrier's number that they text you from. You can leave the content part blank, or you can input a unique phrase from the text message that always stays the same so Tasker will only trigger off of these texts and not any other texts your carrier might send you. Then in the task, all the data you need to process will be stored in %SMSRB, which holds the SMS text content. Simply split until you get the data you've used each month and then you're golden.
 
  • Like
Reactions: TeriusPR

foxsprout

Senior Member
Feb 19, 2014
393
174
Great tutorial! How do you create the widget? Sorry, noob here...

also, what if I want to use different source (other than USSD), like SMS. Since my data usage in USSD only shows unlimited (I'm using unlimited plan with FUP), but when I use SMS, it's showing my left data usage.

Thanks before :)
 

TeriusPR

Senior Member
Jul 13, 2015
111
4
San Juan
The event part was pretty simple but setting the task gave me a little of problem because I'm not sure how to split those variables and what name exactly put in. Do I need something more?
 

Attachments

  • Screenshot_20160308-234927.png
    Screenshot_20160308-234927.png
    185.9 KB · Views: 251

iamagrenade

Member
Apr 15, 2011
5
0
Variable split error

To those of you getting an error when trying to split the variable, see this attached screenshot. It works!

Thanks OP. Good idea.
 

Attachments

  • Screenshot_2016-05-10-19-07-33.png
    Screenshot_2016-05-10-19-07-33.png
    131.1 KB · Views: 336

svampsson

Member
Apr 17, 2016
24
3
Hey , didnt manage to understand whats the the USSD code you mention at the firsts steps of the guide.
Is it the code before the number of a phone?Of my phone or what? :/
It's a "number" you can call. It's different for every carrier but it usually involves a * and a #.

When you call that "number" you get a pup up dialog with some I formation about your sms/phonecalls/data etc.
 

vickylahkarbytes

Senior Member
Dec 25, 2013
75
20
If you're not using an unlimited minutes/data plan, then you might be finding yourself monitoring your usage so you can stop yourself from incurring significant overages on your account. You can use a third-party widget or get notified from your carrier's app (if such a feature exists) but the disadvantages of these are a) the theming abilities of these widgets are limited or b) your carrier's app isn't all that great.

Using Tasker, AutoInput, and USSD codes you can easily grab this data and manipulate it however you want. In my tutorial, I will be grabbing the minutes/data used from T-Mobile USA and incorporate it into a Zooper Widget.

Prerequisites

  1. AutoInput to query the text on the toast input.
  2. USSD codes you can run that will provide you with the remaining minutes/data left in your account. You will have to look these up for your carrier.
  3. OPTIONAL: Zooper Widget, for displaying the minutes/data in the form of a progress bar.

I'm not defining any contexts here for you, but you can set these tasks up to run on whatever trigger you want. For instance, for me I have these two tasks run every night at 1am to update my Zooper Widgets.

Instructions

  • Run the USSD code you want to automatically grab at least one time manually in the phone app. Take a screenshot or write down the text used for reference. It's less than 160 chars since it's an SMS, so don't complain about having to write ;) (You could use Flash action to show what the output is, that's up to you though)
    re6zFTb.jpg
  • Create a task and call it "Call Usage."
  • Phone --> Call. Set the Number to the USSD code that will return how many minutes you have left. For me on T-Mobile USA this is #646#. Check "Auto Dial."
  • Plugin --> AutoInput UI Query. Check "Only Visible" and go down to "Text" and put in some unique, recurring text from the USSD code pop-up that AutoInput will wait to see before querying the screen. For me, I used "Addl minutes are charged" because I'm on a pre-paid plan.
  • Plugin --> AutoInput Action. This one is a bit wonky to set up, but basically you'll want to have AutoInput ready to record your tap input while the USSD is already on screen. To do this I would recommend setting a wait function before running the USSD code, then quickly going to AutoInput and starting the record input function. Once the USSD code is on screen, you can record the input. Optionally, you can use an input tap to have it tap anywhere on the screen to dismiss it.
  • Variables --> Variable Split. Split %aitext(1) in an attempt to isolate the amount of remaining minutes you have. For me, I set the Splitter to "You have"
  • Variables --> Variable Split. Split %aitext12 to fully isolate the number value of the remaining minutes. Here, I did "included minutes" as the Splitter.
  • Variables --> Variable Set. Set Name to %calltotal and set it To your total minutes minur %aitext121. Check "Do Math". This will determine how many minutes you have actually used.
  • (OPTIONAL): Plugin --> Zooper Widget Pro Variable. Set #TCALLUSAGE# (which should be written as CALLUSAGE within the ZW configuration, but is presented to ZW as variable #TCALLUSAGE#) to %calltotal. Now you can display this variable as a part of any Zooper Widget you like!

AzSywx9.jpg

  1. Create a new task called "Data Usage."
  2. Phone --> Call. Number is the USSD code that tells you the data remaining in your plan. For me on T-Mobile USA it's #932#. Again, set it to "Auto Dial."
  3. Plugin --> AutoInput UI Query. Again, like before, click on "Only Visible" and for Text set something unique from the USSD code pop-up that will make AutoInput query the screen when the text pops up.
  4. Plugin --> AutoInput Action. Do the same as before, hell, you can even copy/paste the same action from the previous task to dismiss the pop-up!
  5. Variables --> Variable Split. Split %aitext(1) to isolate the amount of data used. For me, I put "You have used" as the splitter.
  6. Variables --> Variable Split. Split %aitext12 using the splitter to separate the number and its data unit. For me, I set it to "MB"
  7. Variables --> Variable Set. Set Name to %datamb and set it to ceil(%aitext121). This will round-up the data usage to the nearest whole number, so it will display properly in Zooper Widget.
  8. (OPTIONAL): Plugin --> Zooper Widget Pro Variable. Set #TDATAUSAGE# to %datamb. Same idea as before.

TjXiHa4.jpg


Finally, here's what my Zooper Widget looks like (along with my config). My usage had just reset recently so you can't really see much of the progress, though:

iVjGsGf.jpg


uxgG359.jpg
I found out an app which does the same thing and has a well defined widget too
https://play.google.com/store/apps/details?id=fahrbot.apps.ussd.widget.lite
 

radalv

New member
Sep 19, 2014
2
0
Hello, i just found out this thread. i am sorry for bringing up a year old thread, but I have had no luck finding something like this a little fresher.

I have been trying to get this to work in my phone(GS6) and my carrier(Claro Dominicana).

By the time my task reaches the variable split step i get an error. I cannot post the image because I am new to the forums. But basically it says the following: "Variable split: can't split unset value to set %aitext12"


I hope some of you can point me in the right direction.

Regards
 

Top Liked Posts

  • There are no posts matching your filters.
  • 6
    If you're not using an unlimited minutes/data plan, then you might be finding yourself monitoring your usage so you can stop yourself from incurring significant overages on your account. You can use a third-party widget or get notified from your carrier's app (if such a feature exists) but the disadvantages of these are a) the theming abilities of these widgets are limited or b) your carrier's app isn't all that great.

    Using Tasker, AutoInput, and USSD codes you can easily grab this data and manipulate it however you want. In my tutorial, I will be grabbing the minutes/data used from T-Mobile USA and incorporate it into a Zooper Widget.

    Prerequisites

    1. AutoInput to query the text on the toast input.
    2. USSD codes you can run that will provide you with the remaining minutes/data left in your account. You will have to look these up for your carrier.
    3. OPTIONAL: Zooper Widget, for displaying the minutes/data in the form of a progress bar.

    I'm not defining any contexts here for you, but you can set these tasks up to run on whatever trigger you want. For instance, for me I have these two tasks run every night at 1am to update my Zooper Widgets.

    Instructions

    • Run the USSD code you want to automatically grab at least one time manually in the phone app. Take a screenshot or write down the text used for reference. It's less than 160 chars since it's an SMS, so don't complain about having to write ;) (You could use Flash action to show what the output is, that's up to you though)
      re6zFTb.jpg
    • Create a task and call it "Call Usage."
    • Phone --> Call. Set the Number to the USSD code that will return how many minutes you have left. For me on T-Mobile USA this is #646#. Check "Auto Dial."
    • Plugin --> AutoInput UI Query. Check "Only Visible" and go down to "Text" and put in some unique, recurring text from the USSD code pop-up that AutoInput will wait to see before querying the screen. For me, I used "Addl minutes are charged" because I'm on a pre-paid plan.
    • Plugin --> AutoInput Action. This one is a bit wonky to set up, but basically you'll want to have AutoInput ready to record your tap input while the USSD is already on screen. To do this I would recommend setting a wait function before running the USSD code, then quickly going to AutoInput and starting the record input function. Once the USSD code is on screen, you can record the input. Optionally, you can use an input tap to have it tap anywhere on the screen to dismiss it.
    • Variables --> Variable Split. Split %aitext(1) in an attempt to isolate the amount of remaining minutes you have. For me, I set the Splitter to "You have"
    • Variables --> Variable Split. Split %aitext12 to fully isolate the number value of the remaining minutes. Here, I did "included minutes" as the Splitter.
    • Variables --> Variable Set. Set Name to %calltotal and set it To your total minutes minur %aitext121. Check "Do Math". This will determine how many minutes you have actually used.
    • (OPTIONAL): Plugin --> Zooper Widget Pro Variable. Set #TCALLUSAGE# (which should be written as CALLUSAGE within the ZW configuration, but is presented to ZW as variable #TCALLUSAGE#) to %calltotal. Now you can display this variable as a part of any Zooper Widget you like!

    AzSywx9.jpg

    1. Create a new task called "Data Usage."
    2. Phone --> Call. Number is the USSD code that tells you the data remaining in your plan. For me on T-Mobile USA it's #932#. Again, set it to "Auto Dial."
    3. Plugin --> AutoInput UI Query. Again, like before, click on "Only Visible" and for Text set something unique from the USSD code pop-up that will make AutoInput query the screen when the text pops up.
    4. Plugin --> AutoInput Action. Do the same as before, hell, you can even copy/paste the same action from the previous task to dismiss the pop-up!
    5. Variables --> Variable Split. Split %aitext(1) to isolate the amount of data used. For me, I put "You have used" as the splitter.
    6. Variables --> Variable Split. Split %aitext12 using the splitter to separate the number and its data unit. For me, I set it to "MB"
    7. Variables --> Variable Set. Set Name to %datamb and set it to ceil(%aitext121). This will round-up the data usage to the nearest whole number, so it will display properly in Zooper Widget.
    8. (OPTIONAL): Plugin --> Zooper Widget Pro Variable. Set #TDATAUSAGE# to %datamb. Same idea as before.

    TjXiHa4.jpg


    Finally, here's what my Zooper Widget looks like (along with my config). My usage had just reset recently so you can't really see much of the progress, though:

    iVjGsGf.jpg


    uxgG359.jpg
    1
    This is the only popup, and then I receive a text message with all the data usage's numbers.

    Since your carrier is sending you text messages, you will have to intercept the text message content in order to get the data you want. My profile won't work for that, but luckily intercepting text message content is rather simple.

    Simply create an Event, go to Phone --> Received Text. For the Sender, set it to the carrier's number that they text you from. You can leave the content part blank, or you can input a unique phrase from the text message that always stays the same so Tasker will only trigger off of these texts and not any other texts your carrier might send you. Then in the task, all the data you need to process will be stored in %SMSRB, which holds the SMS text content. Simply split until you get the data you've used each month and then you're golden.