LightBlog

samedi 25 mars 2017

How to Automatically Find Beta Updates for All Installed Apps

Beta testing channels of Android apps are the best way for users to test out the newest feature weeks or months in advance, and for developers to test their software with a smaller audience before rolling out their feature to everyone. Google used to make enrolling in beta updates an incredibly frustrating experience. You would first have to join a Google+ community dedicated to that app, wait to be approved by the Google+ community’s moderators (if it’s closed group), and finally wait for Google’s servers to enroll your account in the beta channel of that app.

While presumably a way to ensure that regular users don’t get mixed up in beta programs that they aren’t really committed to, the requirement of a Google+ account was cumbersome. Eventually, Google started allowing users to enroll in beta updates straight from the Google Play Store, although this button isn’t available for every app that has a beta channel.

Furthermore, even though the beta sign-up process is much more accessible than it used to be, how in the world do you know which apps have beta versions available? One thing you can do is to open up your installed apps list in the Play Store and scroll down to the bottom of the page for each and every app you have installed to see if there’s a beta, but that sucks for two reasons. First, as shown by the Whatsapp example above, not every app’s beta is accessible from the Play Store interface. Second, and most importantly, manually checking each and every app takes a really long time.

I have 280 applications installed (including system apps), so there’s no way I’m combing through the Play Store to manually find beta programs. Most of the beta programs I’ve joined have been out of necessity, such as to use a feature only available in an AutoApps beta version, or incidentally when someone links a beta program on social media. A lot of us have a ton of applications that we use every day, and the beta version potentially has really awesome features we’re missing out on right now. But none of us want to go through the trouble to filter out what apps we’re eligible to beta test out of the huge amount of apps we have installed. That’s why I came up with an automated script to do that for you. Introducing the find beta Tasker script!

As you can see in the screenshots above, my script creates a list of apps that I have installed on my device that I am currently eligible to enroll in a beta update for. This list is created as an HTML file, which means it can be opened in a browser such as Chrome so you can click on the links and enroll in betas one-by-one. By using this list, you’ll cut down on the time and effort needed to manually find and enroll in beta updates for all of your installed apps. Plus, you’ll discover beta channels for apps that you never even knew existed, even pre-installed system apps by OEMs!


Find Eligible Beta Programs for All Installed Apps

When I say eligible, I mean beta programs that your Google account can actually enroll in. Not every app has a beta program, and not every app’s beta program allows you to join it. Whether or not you can join a beta program is up to the developer, but if you’re eligible for a beta program, this script will help you find it.

Requirements:

The reason we need Tasker is obvious: this script is built using it. We need AutoTools (the beta version in particular) because it offers a feature called HTML read, allowing us to pull the raw HTML data from webpages. Essentially what we’ll be doing is pulling the HTML from the Play Store beta program for each app we have installed and using some HTML parsing magic to see if the text on the page indicates that there’s a beta channel available. If it is, we log the app name and add it to our list.

Unlike previous tutorials, this script does not involve a Profile of any kind, as there’s nothing to “trigger” it. This script is just a lone Task, because it should only be run manually by the user once in a blue moon. I’ll show you how to create the Task, but for those of you who are pros at Tasker, here’s the Task description that you can see by expanding the toggle below.

Find Betas Tasker Task


Find Betas (209)
<<strong><h2>This script was made by XDA-Developers.com</h2></strong>
<h3><font color="red">Before running this script, you need to authenticate AutoTools. Open this Action's configuration and tap on "Authenticate" at the bottom.</font></h3>>
A1: [X] AutoTools HTML Read [ Configuration:URL: http://ift.tt/2n2RP5r Timeout (Seconds):60 ]
A2: List Apps [ Type:Package Match: Store Result In:%packages ]
A3: Flash [ Text:You have %packages(#) apps installed. Please be patient while this script runs. It can take anywhere between 1-2 minutes depending on how many apps you have. Long:On ]
A4: For [ Variable:%package Items:%packages() ]
A5: AutoTools HTML Read [ Configuration:URL: http://ift.tt/2nQBV2x
CSS Queries: html > body > main > div:nth-child(2) > p:nth-child(1),html body main div h1
Variable Names: invite,name Timeout (Seconds):60 ]
A6: Test App [ Type:Package Name Data:%package Store Result In:%appname ]
A7: AutoTools Text [ Configuration:Text: %invite
Joiner Variable: atjoinedtext
Match Text: has invited you to a testing program for an unreleased version
Separator: π Timeout (Seconds):60 ]
A8: Array Push [ Variable Array:%betas Position:1 Value:%appname---%package Fill Spaces:Off ] If [ %atmatches() ~ true ]
A9: End For
A10: Array Process [ Variable Array:%betas Type:Sort Alpha ]
A11: For [ Variable:%betatest Items:%betas() ]
A12: Variable Split [ Name:%betatest Splitter:--- Delete Base:Off ]
A13: Write File [ File:/sdcard/Tasker/Beta_Test_List.html Text:<a href="http://ift.tt/2nQqhEV">%betatest1</a><br> Append:On Add Newline:On ]
A14: End For
A15: Open File [ File:Tasker/Beta_Test_List.html Mime Type:text/html ]

Setup

Before we start listing a step-by-step guide, you’ll need to go through a brief setup process that only needs to be run once (unless you uninstall or clear the data of AutoTools). Because checking whether or not you are eligible for certain Play Store beta programs requires authenticating your Google account to pull that information, we have to authenticate AutoTools. This is fairly easy to do, fortunately.

Open up Tasker and create a new Task called Find Betas (or whatever you want to name it, really). Create a new Action and go to Plugin –> AutoTools –> HTML Read. Press the pencil icon to open the configuration screen for AutoTools. For the URL enter the following address

http://ift.tt/2n2RP5r

Once you’ve done that, scroll down to the bottom of the config screen and tap on Authenticate.  You’ll be led to a Google sign-in screen to access the Play Store on your account. Sign-in with the Google account you use to download all your apps on. Once you reach the Play Store landing page, hit the back button to exit the configuration screen. Now AutoTools is properly authenticated, so it can now pull from the beta testing landing page while logged into your account.

Guide

And now, here’s a step-by-step instruction guide to make this task. Be warned: some of the steps here are pretty advanced. I’m not going to explain how everything works in great detail, but I’ll give a general overview of how each step works.

  1. App –> List Apps. Type: package. Store result in: %packages. This will list all of your installed packages, and store them in an array.
  2. Task –> For. Variable: %package. Items: %packages(). This will iterate through all of your installed packages, one by one.
  3. Plugin –> AutoTools –> HTML Read. URL: http://ift.tt/2nQBV2x. Variable Names: invite,name. CSS queries: html > body > main > div:nth-child(2) > p:nth-child(1),html body main div h1. This will read the beta landing page for the current package and store the page’s text in a variable.
  4. App –> Test App. Type: package name. Data: %package. Store result in: %appname. Get the app name associated with the current package.
  5. Plugin –> AutoTools –> Text. Text: %invite. Match text: has invited you to a testing program for an unreleased version. Separator: π. Check to see that the text shown on the beta landing page and see if it says that there’s a beta channel we can sign up for.
  6. Variables –> Array Push. Variable Array: %betas. Position: 1. Value: %appname—%package. Check if and set it to if %atmatches()true. If there is an eligible beta, add it to an array.
  7. Task –> End for.
  8. Variables –> Array Process. Variable Array: %betas. Type: sort alpha. Re-arrange the list alphabetically.
  9. Task –> For. Variable: %betatest. Items: %betas().
  10. Variables –> Variable Split. Name: %betatest. Splitter: 
  11. File –> Write File. File: /sdcard/Tasker/Beta_Test_List.html. Text: <a href="http://ift.tt/2nQqhEV">%betatest1</a><br> Check append and add newline.
  12. Task –> End for.
  13. File –> Open File. File: Tasker/Beta_Test_List.html. Mime Type: text/html.

That’s it for this script. All you’ll need to do is the press the run button (the play icon in the bottom left corner) and let the script run. Depending on how many apps you have installed, it can take anywhere between 1-2 minutes for it to finish. You’ll see the screen bob up and down as the Task goes through the for loop, but so long as you authenticated AutoTools in the beginning, it’ll finish and ask you to open the HTML file using either the stock HTML viewer or your browser app.


Download and Import

As always, we’re providing the file you need to import this script if you’re looking to just try this out immediately. Download the below .tsk.xml file and save it anywhere on your internal storage. Open Tasker and disable Beginner Mode in Preferences. Go back to Tasker’s main menu and long-press on the Tasks tab up top until you see a dialog pop up. Press Import and look for the XML file you saved earlier and select it to import it.

Download the Find Betas Tasker Script

Take note of the giant disclaimer up top when you import this. You have to authenticate AutoTools with your Google account before this Task will work. Just open Action #1 (which is disabled so it won’t run on it’s own) by tapping on it and press the pencil icon to open AutoTools configuration. Scroll to the bottom and tap on Authenticate. You should see a prompt to log-in to your Google account. Do it, and once you reach the Play Store landing page, hit the back button. Now, go back and run the Task by hitting the “play” icon in the bottom left corner.

I hope you find this Task useful. I discovered a ton of beta channels that I was eligible for, many for apps that I never expected to have beta channels. This script certainly saves a lot of time in finding beta updates for your installed apps, though for me personally that time was negated by the time it took to make this Task!

Let us know if you find this script useful, and if you have any suggestions for future tutorials.



from xda-developers http://ift.tt/2ogV4Hw
via IFTTT

Aucun commentaire:

Enregistrer un commentaire