Jump to content

[HOWTO] "Automated" Sensorly LTE data collection with Tasker


Recommended Posts

I decided to make this it's own thread, as I've gone and made it overly complicated.

 

Since we're letting our geek flags fly... Here is my Tasker setup that I created to aid me in tracking down LTE signal. I created this because if you're trying to be a "Sensorly Cartographer" like myself, it's annoying to have to keep your phone in front of your face all of the time, switching in and out of airplane mode, checking to see if the 3G now reads 4G. The most annoying thing for me is that if you lose your LTE signal, you'll have to 1) notice that it's gone, and 2) start cycling airplane mode again. This setup automates that, so if you're searching with Sensorly you just have to hit a button, and if there's LTE around you'll connect to it a lot faster. It's got a few moving parts to it, but so far it's worked out for me.

 

WARNING: be aware that this WILL increase your battery consumption if (for some reason) you leave it running when not activily mapping.

 

I highly recommend anyone who loves their Android phone to buy Tasker. I've had it for years, and am able to automate so many parts of my phone with it. I know I'm just scratching the surface with what I use it for too.

 

To fully utilize this you'll be creating 3 tasks, 2 profiles and a widget icon on your home screen.

 

Task 1: "Modified Airplane Mode Toggle" (Download here: Task-ModifiedAirplaneModeToggle.xml)

 

Modified Airplane Mode Toggle
A1: Flash [ Text:Airplane Toggle Long:Off ]
A2: Airplane Radios [ Bluetooth:Off Cell:On NFC:Off Wifi:Off Wimax:On ]
A3: Airplane Mode [ Set:On ]
A4: Wait [ MS:0 Seconds:20 Minutes:0 Hours:0 Days:0 ]
A5: Airplane Mode [ Set:Off ]

 

What it does: it turns a modified airplane mode on (modified because I kept getting annoyed at the regular airplane mode cutting off my bluetooth headphones), waits 20 seconds, and toggles the airplane mode back off. 20 seconds is long enough for radio to do an LTE scan when it comes back online.

 

On line A1, when things are set to "On" that means that they will be disabled by a Tasker Airplane Mode action, and "Off" means they won't be disabled by Tasker's Airplane Mode. I also set Wimax to "On" because, well, why not?

 

Task 2: "4G Scan Monitor" (Download here:Task-4GScanMonitor.xml)

 

4G Scan Monitor
A1: If [ %4GSCAN Is Set ]
A2: If [ %HAVE4G ! Set ]
A3: Perform Task [ Name:Modified Airplane Mode Toggle Stop:Off Priority:5 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ]
A4: Wait [ MS:0 Seconds:45 Minutes:0 Hours:0 Days:0 ]
A5: Goto [ Type:Action Number Number:1 Label: ]
A6: End If
A7: End If

 

This simulates a while loop, checking to see two things: if you have turned on your "scanning" widget to scan (more on that in a bit), and if you currently do not have 4G coverage (keep reading!). It then runs the "Modified Airplane Mode Toggle", waits 45 seconds, and goes back to the first line.

 

Task 3: "Airplane Toggle Widget" (Download: SEE BELOW)

 

Airplane Toggle Widget
A1: If [ %4GSCAN Is Set ]
A2: Variable Clear [ Name:%4GSCAN Pattern Matching:Off ]
A3: Set Widget Icon [ Name:Airplane Toggle Widget Icon:<icon> ]
A4: Else
A5: Variable Set [ Name:%4GSCAN To:1 Do Maths:Off Append:Off ]
A6: Set Widget Icon [ Name:Airplane Toggle Widget Icon:<icon> ]

 

This is the logic behind the widget button you'll create later. It just sets/unsets the variable that controls whether or not you will be popping into/out of airplane mode.

 

Profile 1: "In LTE" (Download here: Profile-InLTE.xml)

 

Profile: In LTE
State: Mobile Network [ 2G:Off 3G:Off 3G - HSPA:Off 4G:On ]
Enter: Anon
A1: Variable Set [ Name:%HAVE4G To:1 Do Maths:Off Append:Off ]
Exit: Anon
A1: Variable Clear [ Name:%HAVE4G Pattern Matching:Off ]
A2: If [ %4GSCAN Is Set ]
A3: Perform Task [ Name:4G Scan Monitor Stop:Off Priority:5 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ]

 

This profile sets a variable when you enter into 4G coverage. When you leave/lose 4G, it will check to see if you're currently in "scanning mode". If you are, it will start the scan over again.

 

Profile 2: "Run 4G Scan" (Download here: Profile-Run4GScan.xml)

 

Profile: Run 4G Scan
State: Variable Value [ Name:%4GSCAN Op:Is Set Value:* ]
Enter: 4G Scan Monitor

 

This simply monitors the variable set by your widget toggle, and runs the "4G Scan Monitor" task.

 

To add the widget:

 

Long press on your launcher home screen: select Widget. Scroll down to "Tasker" and select "Task". From the list that pops up select "Airplane Toggle Widget".

 

How to use:

  1. Start Sensorly
  2. Get a GPS lock
  3. Click the Start button on the Map Trip screen
  4. Hit your Home button to return to your launcher
  5. Tap the "Airplane Toggle Widget" you added earlier
  6. ...
  7. Profit!

This will keep Sensorly running in the background. If/when your phone latches on to 4G, Sensorly will immediately start recording your 4G points.

 

Hints:

 

Recommended reading: http://forum.xda-dev...d.php?t=1110775

 

I have also attached the two Profile XML files you can import directly into Tasker to make setting all of this easier. The should set up Profiles 1 and 2, as well as Tasks 1 and 2.

 

For some reason the forum won't let me upload the XML file for the Airplane Toggle Widget. Just copy and paste the following into an XML file named "AirplaneToggleWidget.xml", and import it that way.

 

<TaskerData sr="" dvi="1" tv="1.3.3u2m">
<Task sr="task89">
<cdate>1354205330359</cdate>
<edate>1354207750344</edate>
<id>89</id>
<nme>Airplane Toggle Widget</nme>
<Action sr="act0" ve="3">
<code>37</code>
<lhs>%4GSCAN</lhs>
<op>9</op>
<rhs></rhs>
</Action>
<Action sr="act1" ve="3">
<code>549</code>
<Str sr="arg0" ve="3">%4GSCAN</Str>
<Int sr="arg1" val="0"/>
</Action>
<Action sr="act2" ve="3">
<code>152</code>
<Str sr="arg0" ve="3">Airplane Toggle Widget</Str>
<Img sr="arg1" ve="2">
<icn>2130837588</icn>
</Img>
</Action>
<Action sr="act3" ve="3">
<code>43</code>
</Action>
<Action sr="act4" ve="3">
<code>547</code>
<Str sr="arg0" ve="3">%4GSCAN</Str>
<Str sr="arg1" ve="3">1</Str>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
</Action>
<Action sr="act5" ve="3">
<code>152</code>
<Str sr="arg0" ve="3">Airplane Toggle Widget</Str>
<Img sr="arg1" ve="2">
<icn>2130837617</icn>
</Img>
</Action>
<Img sr="icn" ve="2">
<icn>2130837588</icn>
</Img>
</Task>
</TaskerData>

 

To import the Tasks and Profiles

 

First download the XML files to your phone. In certain browsers they will ask you if you want to open the file with Tasker. If your browser just offers to save the file, use a file explorer to move it to /sdcard/Tasker/tasks (for Tasks) or /sdcard/Tasker/profiles (for Profiles). Then go into Tasker and do a long-tap on the Profiles tab header. To import Tasks do the same on the Tasks tab header.

 

Please let me know if you find any errors in my logic, as I'm sure there are a few.

 

Happy hunting!

  • Like 3
Link to comment
Share on other sites

I was able to create the task, but I cant import the profiles on tasker.

Did you get any errors? What process did you use? Did you download it using your phone?

 

Try this: On your phone, open this page in the browser. When you click on the xml file, it should ask you if you want to open it with Tasker. Once you've done that, go back into Tasker and try the import again.

Link to comment
Share on other sites

To open the files in Tasker directly, they need the correct file extensions; the Task files need to have the extension .tsk.xml and the Profile files need the extension .prf.xml

Thanks for pointing this out. I'm trying to edit my post, but it's not showing me the option right now.

Link to comment
Share on other sites

Nice, anyone find a way to do this with llama?

I just downloaded llama and unfortunately it doesn't look like it supports the cell state conditions to make this usable.

 

Sent from my SPH-L900 using Tapatalk 2

 

 

Link to comment
Share on other sites

How often do our phones natively look for 4g? I mean, they must check every now and then right?

 

They do, however, some phones just refuse to connect properly, and some with ease.

Link to comment
Share on other sites

Nice, anyone find a way to do this with llama?

 

Tina?

 

http://www.youtube.com/watch?v=c2glOppqBRg

 

I have to be honest. The Android developer community is probably a little bit too active and chooses some of the most ridiculous names.

 

AJ

  • Like 1
Link to comment
Share on other sites

Whats the news on the Galaxy Nexus? Is it playing nice with LTE? (though I suppose I am running ROMs so that could effect that)

 

I don't know. I just got mine on Black Friday & haven't been to any LTE areas yet. There are a few others that have been having an easy time with LTE on theirs.

Link to comment
Share on other sites

Is airplane mode really necessary? I see everyone else doing it, but for me, switching between LTE/CDMA and CDMA/EvDo works really well. Usually I'm connected to LTE within 1-2 seconds of hitting LTE/CDMA (If I'm in reach of an LTE tower of course.)

 

Whats the news on the Galaxy Nexus? Is it playing nice with LTE? (though I suppose I am running ROMs so that could effect that)

It does, but I've also experienced a bit of hanging on to 3G in an obviously-4G area. I think it just varies. Plus, it doesn't help that I'm usually in a moving car.

Link to comment
Share on other sites

  • 4 weeks later...

I'm having problems with my Mobile Networks -> Connections Optimizer locking up and getting com.android.phone has stopped error. I'm posting this here because I think it has some relationship to what we're doing here...especially since I found the fix was posted on another forum by enormous!

http://forum.xda-developers.com/showthread.php?t=1957107

 

Have others had this problem when trying to go in and change your Mobile Network?

 

Also, enormous... How do you restore it and its data? I'm not sure what to do to fix the issue. I do not have a backup, if that's necessary.

 

A related issue (I think), is that my Tasker toggle scripts are not working currently while this is an issue. I'm guessing its related, but it says its running the 4G LTE Scan, but it won't go in and out from Airplane mode. So I'm guessing this is the reason.

Link to comment
Share on other sites

Did you remove Connection Optimizer with anything? I had used Titanium Backup (TiB) to remove it, and once I had restored the app and it's data I stopped getting the phone stopped error.

 

If you don't have a backup, I could PM you a copy of mine. This might work. But you'd still need TiB to restore it. Let me know if you'd like to try that.

 

Now I just have the Connection Optimizer frozen through TiB and all is well.

 

I would also guess that the issue with Connection Optimizer is why the toggle scripts aren't working.

Link to comment
Share on other sites

No, I didn't remove it. I had this problem with the stock rom, and then installed blaze rom (or something) and it was fine for a while. Not sure if it started when I started using the Tasker script.

 

But yeah if you could send that over, I'll give it a try. I really appreciate it.

 

Sent from my SPH-L710 using Tapatalk 2

 

 

Link to comment
Share on other sites

After reinstalling/reflashing my ROM I continued to have problems.

 

After trying to figure out how the Tasker script worked (I've never played with it, but I am a programmer), I realized that the problem was with a variable %HAVE4G. For whatever reason my phone had %HAVE4G set to 1 all the time. So I added a 'Variable Clear' as step 3 in the Airplane Toggle Widget, right after it clears the %4GSCAN variable.

 

This seems to have the script working properly now on my phone. You can correct me and tell me if this will have any ill effects when I actually do go into 4g coverage or at other times with the script, but as far as I can tell, it may need to clear that variable in new script installs.

 

My guess is that I went into 4G at some point and that variable got stuck in memory. Perhaps I killed the script before leaving 4G and it prevented the script for working correctly thereafter???

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • large.unreadcontent.png.6ef00db54e758d06

  • gallery_1_23_9202.png

  • Similar Content

  • Posts

    • In the conference call they had two question on additional spectrum. One was the 800 spectrum. They are not certain what will happen, thus have not really put it into their plans either way (sale or no sale). The do have a reserve level. It is seen as great for new technologies which I presume is IOT or 5g slices.  They did not bite on use of their c-band or DOD.  mmWave rapidly approaching deadlines not mentioned at all. FWA brushes on this as it deals with underutilized spectrum on a sector by sector basis.  They are willing to take more money to allow FWA to be mobile (think RV or camping). Unsure if this represents a higher priority, for example, RVs in Walmart parking lots where mobile needs all the capacity. In terms of FWA capacity, their offload strategy is fiber through joint ventures where T-Mobile does the marketing, sales, and customer support while the fiber company does the network planning and installation.  50%-50% financial split not being consolidated into their books. I think discussion of other spectrum would have diluted the fiber joint venture discussion. They do have a fund which one use is to purchase new spectrum. Sale of the 800Mhz would go into this. It should be noted that they continue to buy 2.5Ghz spectrum from schools etc to replace leases. They will have a conference this fall  to update their overall strategies. Other notes from the call are 75% of the phones on the network are 5g. About 85% of their sites have n41, n25, and n71. 93% of traffic is on midband.  SA is also adding to their performance advantage, which they figure is still ahead of other carriers by two years. It took two weeks to put the auction 108 spectrum to use at their existing sites. Mention was also made that their site spacing was designed for midrange thus no gaps in n41 coverage, while competitors was designed for lowband thus toggles back and forth for n77.  
    • The manual network selection sounds like it isn't always scanning NR, hence Dish not showing up. Your easiest way to force Dish is going to be forcing the phone into NR-only mode (*#*#4636#*#* menu?), since rainbow sims don't support SA on T-Mobile.
    • "The company’s unique multi-layer approach to 5G, with dedicated standalone 5G deployed nationwide across 600MHz, 1.9GHz, and 2.5GHz delivers customers a consistently strong experience, with 85% of 5G traffic on sites with all three spectrum bands deployed." Meanwhile they are very close to a construction deadline in June for 850Mhz of mmWave in most of Ohio iirc. No reported sightings.
    • T-Mobile Delivers Industry-Leading Customer, Service Revenue and Profitability Growth in Q1 2024, and Raises 2024 Guidance https://www.t-mobile.com/news/business/t-mobile-q1-2024-earnings — — — — — I find it funny that when they talk about their spectrum layers they're saying n71, n25, and n41. They're completely avoiding talking about mmWave.
    • Was true in my market. Likely means a higher percentage of 5g phones in your market.
  • Recently Browsing

    • No registered users viewing this page.
×
×
  • Create New...