Is your Android battery life too short? Some ideas that might fix it

Periodically, my  Nexus 5 phone’s battery life is terrible. On good days, if I don’t use my phone, the battery discharge rate is slow – many hours later, the battery meter says there’s still over 90% of the battery charge remaining. But when it is bad, my unused phone can have its battery drain in 8 hours.

I have found two things to improve improve the battery life on my Google Android Nexus 5.

  • One is to clear the system cache partition – this cache setting is not accessible from Settings.
  • The other is to replace the Android launcher with Nova Launcher, available for free in the Google Play store.

How to Clear the System Cache Partition

To clear the system cache you need to enter a hidden Android start up menu, usually by starting your phone while pressing the power and volume control keys simultaneously. For specific instructions, see this explanation for the Nexus 5 (it might work on your phone too – this does work on my Nexus 5). Another list from a mobile phone service describes how to do this for other phones (I have not tested any of those).

Every few months, the battery life has gotten really bad. But after clearing the system cache partition, the phone returns to normal performance. I hope this works for you.

I noticed this might be related to my installing lots of apps on the phone, over and over again. Some days I’ll install my test app 10 or 20 or 30 or more times. After a few weeks of doing this every day, battery life problems develop. I clear the system cache partition and the phone is fine again.

You can learn more about the Android system partitions by reading this article.

Part 2: Storing and accessing user interface components as variables

Part 1 showed how to reference and store user interface components as a variable. That tutorial used this method to easily change the background colors of six buttons on screen.

In Part 2, we use this technique to simplify a past tutorial about using a Bluetooth link between and Android device and two Arduino devices.

Continue reading

Security: http versus https and access to the web site

As you may know, http is the old way to access a web site. https is the newer secure method that encrypts data sent to and from the web site.

Last year, Google announced it would rank search results such that web sites accessed via https rank higher than those using http.

This web page has been using http – which is okay since there is nothing secret or controversial about the content here.

However, on 7 March 2017, Firefox will launch an update that will issue a security warning when visiting web sites using http.

Consequently, we need to switch our web sites from http to https which involves paying a fee to buy an SSL security certificate and re-configuring software and servers.

I have successfully converted my web site to https as a test for the conversion. So far everything looks good.

I will eventually convert the web site to use https also. I do not have a date for that – it could be next week or the end of the month.  When I do the conversion, their might be a temporary period where you receive a security warning about accessing the web site, depending on how I do that update.

Part 1: Storing and accessing user interface components as variables

App Inventor programmers routinely store values, such as numbers or text strings (“Hello!”) in variables. For example,

stores the numeric value 6 in to the variable TOTALBUTTONS.

To illustrate by example, here is a global variable named SpecialButton. We can initialize it to anything we want at this point.

Next, inside our app, our blocks code assigns Button1 to the variable SpecialButton. SpecialButton now holds a reference to the actual user interface control Button1.

Since SpecialButton is a variable and not an actual button, we cannot directly use a SpecialButton.Click handler but we can use a feature of App Inventor to do the same thing in a different way. We will see how to do this in this a bit later.

You can store any App Inventor components – a Clock, a Bluetooth device – any component, in a variable.

Why would you want to do that? We will see in the example in this lesson.

This tutorial is in both written form and as an online video.

Continue reading