The Man In The Disk

Share if the site was helpful

The Man In The Disk

If you’ve ever taken an introductory class on cyber security (or if you’ve explored the topic on your own), then you’re likely familiar with the term MITM.  Man-In-The-Middle attacks are security breaches where a 3rd party butts their way in-between two parties attempting to communicate.  Obviously, this is not an ideal situation for either party, and a new variation of MITM is taking Android users by storm.

MITD

Man-In-The-Disk (MITD) is the name that’s been flying around the past few days.  But before we get into its details, let’s discuss a little more of what MITM attacks entail.  A MITM attack is when an unknown party inserts itself between the two trying to communicate.  When this is done that malicious party is able to spy on the conversation happening.  Even worse they might altar what is being sent.

As an example let’s picture an everyday conversation between two friends.  Person 1 and 2 are talking to one another about their plans for tonight.  And let’s say person 3 is bitter they didn’t get invited.  Person 1 might send 2 a message online asking “Want to meet up at 8?”, but 3 intercepts it, changes it, and then forwards the newly modified message to 2.  Now when 2 opens the message it instead says “On second thought there are cooler people I’d rather spend my time with”.  (A riveting example, right?)

The idea is simply that a 3rd party can both invade and modify conversations between clients and servers.  And a lot of the time the invasion can be a lot more critical than hurt feelings.  MITM attacks can be avoided by taking proper precautions and such as certificate pinning.  But that deserves a whole post of its own.

So How Does It Happen?

MITD attacks are a specific type of MITM that takes advantage of careless storage on users phones.  MITD attacks can allow 3rd party users to access information that is stored on an android device’s external storage.  This is something that many apps don’t use, but researchers at Check Point recently found that many app developers (including Google itself) are not following the recommended security precautions for avoiding this vulnerability.

There are a couple different methods for storing information in Android apps.  Android’s developer website has a good page laying out the differences between them.  If you want to go deeper into when using each is appropriate PhonLab covers this in its Android Development Course.   For the most part Android security is very sound due to sandboxing.  This is the idea that each app silo’s its information and only makes it available to others if either the user allows it or if both apps are on board for sharing.

External Storage

External storage is essentially a part of the device’s storage card that is shared by all applications. Google suggests that developers should add extra validation if apps utilize this storage functionality.  And unfortunately it seems that a lot of apps currently aren’t doing this.  Due to prioritization of external storage, data coming in to the phone may be subject to MITM attacks before it even reaches the app meant to use it.

Ironically Google was not following this advice either.  Since the report came out they’ve addressed the places where they were falling short, but it seems many other apps have made the same mistake and will be named after they correct their issues.

In conclusion, there is a security scare going around for android apps, but don’t overhype it.  If developers take the proper precautions to prevent MITM attacks (something Google explains easily how to do on their site) then this danger fades away.  Security is an ever-changing field, but this breach is one that can be easily avoided if developers do their due diligence.

 

Fortnite Could Change The App Market As We Know It

Share if the site was helpful

Fortnite Could Change The App Market As We Know It

Fortnite, the first person survival shooter game that has taken the world by storm, has finally made its way to Android.  I’m sure it will be a blast to play, but this isn’t the place to read reviews of videogames.  So why are we bringing it up?  Because Fortnite with its popularity has brought some light to a very deep discussion for what the future of apps looks like.  It’s more than a videogame, it’s the start of a movement.

Some Background

For those who aren’t familiar with the game’s success thus far, Fortnite has become one of the most popular games of all time and is played on PCs, gaming consoles, and iPads/iPhones.  It’s been developed for all of these different systems so that virtually anyone that has an electronic gadget has the opportunity to play, and for months now its been building up to its Android debut. 

This would just be another story of a successful video game, except that Epic Games (Fortnite’s creator) has made a bold decision for its distribution strategy.  They decided to forgo the common pathway of sharing their app on the Google Play Store.  Instead they will be distributing the app in their own digital store and keep the 30% “store tax” that Google would otherwise keep from in-app purchases.

Fortnite Paves Its Own Path

“It’s a high cost in a world where game developers’ 70 per cent must cover all the cost of developing, operating, and supporting their games.”  Epic said about the decision.  “And it’s disproportionate to the cost of the services these stores perform, such as payment processing, download bandwidth, and customer service.”

Epic has shared its opinion that the app market is a highly monopolized one where developers are unfairly being taken advantage of.  Google and Apple have grown to such high user adoption rates that users don’t get apps from anywhere else.  This means that as a developer you either play by their rules or you don’t play at all.  Epic isn’t the first entity to share this sentiment, and the EU has even recently filed a lawsuit against Google for monopoly abuse.

Breaking The Cycle

Fortnite just happens to be such an incredibly popular game that it could potentially survive playing by its own rules.  Sure it won’t get as many downloads as it would on the Google Play Store, but it could still prove a successful venture which would open a serious discussion about other companies following suit.

To give Google a little credit Android phones do have the capability to download apps from 3rd party sources, it’s just not as common or streamlined a process.  Apple on the other hand has completely rejected this philosophy and gives users the choice of their app store, or users jailbreaking their phones to get what they want.

In the age of tech giants its hard to not just accept the fact that these monopolies exist and are becoming solidified.  So when a discussion is brought to the table about a potentially unfair situation arising it’s imperative that we keep an open mind and think about what impact can be made in the long run to ensure a healthy a thriving market economy.  Anti-trust is a sticky, sticky issue, but that doesn’t mean it shouldn’t be discussed.

The Google Play Store is a great tool that tons of developers (myself included) get to use to share their creations with the world, but every system needs checks and balances or else it will eventually experience abuse.  It will be interesting to see how successful a venture Fortnite on Android will be without involving itself in the Play Store.  What do you think about Epic’s decision?  Let us know in the comments below!

 

Android Pie is Fresh Out Of The Oven

Share if the site was helpful

Android Pie is Fresh Out Of The Oven

Today Google officially dubbed the newest version of the Android operating system as Pie!  Along with this naming they’ve also released the first official version of it to Pixel phones.  Android users around the world are debating whether this was the right dessert name or not, but either way we know that Pie has some great things in store for us.

The Build Up:

Over the past few months we’ve seen a few beta version of Pie released on a series of smartphones, but this official release is only available on Pixel phones.  People who signed up for the Android Beta program will receive the update by the end of this fall though.  Google also said it’s working to launch/upgrade other devices sometime this year.

Those details are pretty vague, and if Pie behaves anything like other Android versions, it could be over a year before it’s adoption rate breaks double digit percentages.  All the same it’s officially available to Pixel users and it has a name.  That’s plenty for now, but let’s also not forget that Pie is available in its beta format on a number of different devices.

A review of Pie:

We’ve talked about Pie and its cool new features a few times here at RootJunky.com.  The new software is designed with predictive analytics and AI for battery power as some of the main features.  The idea is to improve things behind the scene for users.  Pie monitors and adjusts screen brightness as well as what apps are in the background during different times of the day.  It gets used to user’s habits, and then preps itself in advance to recreate that behavior.  AI is definitely a buzz-word, but that doesn’t mean it can’t have some perks.

It also features an official dark mode option in settings, something Android user’s have been asking for for years.  Notifications also offer features such as smart replies for texting and a new feel to them, so the changes in this version are both front and back end.

Aaand the Notch:

Of course when we’re talking about new looks we have to mention the notch.  It’s taken a hold of both the iOS and Android markets so much that Google has actually come out and banned phones with more than 3 notches from getting Google support.  Somewhat crazy to even think more than 3 notches could exist on a phone right now, but you never know!

One more feature that I have to mention that I’m very excited for is the change to rotation.  Instead of just locking your rotation or having it rotate every time you accidentally turn your screen, you now have optional re-orientation.  Android Pie will display a small button when it detects a screen rotation, and if you select this then the phone knows to readjust, and if not then you can continue doing things as you were, undisturbed.

The Pixel 3 will be coming out on October 4th just a few months from now, and it will likely be the first phone to be released with Pie as it’s initial operating system, but Pie is now available to those who are willing to take the steps to get it.  I’m excited to see it grow this year, and I’m also very interested to see what Q is going to be named.

What are your thoughts on Pie’s name?  Could Google have done better?  And if so, do you think it’s new features will make up for it? Let us know in the comments below.

 

Will Fuchsia be Android’s Usurper?

Share if the site was helpful

Will Fuchsia be Android’s Usurper?

Android is the world’s most popular mobile operating system, and for good reason.  It’s created both high end and affordable options for users worldwide to experience what it has to offer.  And what is has to offer has been time and time again improved upon.  That being said, improvements are always happening in the tech world, and 5 years from now Android might not hold it’s place as #1.  Here’s a curve ball for you: I’m not talking about Apple.  Android’s upcoming replacement may be Fuchsia.

Wait…what the heck is Fuchsia?

For a few years now a stealthy group on engineers at Google have been working on Fuchsia.  The project came into existence as a potential solution to Android’s limitations.  It’s being designed with voice interactions and security updates in mind where the current Android platform falls short.  And while this has been quiet, it hasn’t been locked down.  Some of the code has been open source since 2016 and outside app developers have been allowed to experiment with it.

The Fuchsia team has a higher goal than just more efficient software though.  They’re attempting to design something that will make interaction with all in-house gadgets a fluid experience.  Imagine a single operating system that controls all your speakers, tv, and other residential tech.  Now imagine also being able to interact with all of these devices by speaking to them.  Your house becomes a sentient being, somewhat like this post we wrote a few months back.

So Android will be gone in 5 years?

No, I definitely exaggerated in that first paragraph.  5 years would be an insanely quick turnaround for Android to completely fall off the map.  Android currently dominates as king with roughly 75% market share compared to Apple’s 15%.  Still, it’s far from perfect.  There are performance, privacy, and security concerns with out of date Android phones that need to be addressed, and a new software like Fuchsia could help jump that transition forward.  All the same we’ll be seeing Android phones for quite some time still, and P hasn’t even reached the market!

Fuschia is being developed with audio interactions at its core.  There haven’t been any apps built on it at a serious commercial level yet, but rumors are flying that we’ll be seeing a YouTube app with voice command soon.  My prediction is that over the next year or two Fuchsia is going to grow in the open source community until its eventual official launch, at which point we’re going to see a boom (hopefully a quicker boom than new Android version adoption rates!).  I’ll be keeping a close eye on it, so stay tuned for more updates.  And if you have any thoughts about Fuchsia or it’s potential let us know here!

 

Android P Releases Its Final Beta

Share if the site was helpful

Android P Releases Its Final Beta

While Android Oreo is just starting to hit its stride, Android P is making news too.  This week Google released the final beta preview of Android P before it’s official launch.  We’ve seen a few beta previews so far this year, and this one should be even closer to what P will look like when it launches.

According to Android VP Dave Burke this beta includes “final system behaviors” meaning Google’s new gesture-based navigation will be locked in and shipping with Android 9.0.  Of course there’s always room for improvement, and that’s a large reason betas exist, but this should be stable for installation on your main phone.  Google hasn’t mentioned any known bugs, so if you have a phone that can handle it out get the beta and let us know what you think!

What’s new in P?

We’ve talked before about Android P and what features it has to offer.  Spoiler: they’re awesome.  P offers a series of features that revolve around the idea of predictive analytics.

There’s an adaptive battery that takes into account what time of day you typically are running your apps, and if it doesn’t think you’ll be using them any time soon it shuts them off to save energy.  Couple this with the screen brightness which auto adjusts based on what you typically set it to throughout the day, and you’re looking at a much longer lasting battery life.

Apart from performance improvements, we also have completely new features that enable us to experience things differently.  One I’ve talked about before at length is Wi-Fi RTT.  Round Trip Time is a method of really getting to know your exact current location.  It’s accurate within about a meter, and does so by triangulating between multiple Wi-Fi access points nearby.  This improved location methodology offers some cool opportunities that just depend on how creative developers want to get.

Privacy Improvements:

There are also security improvements that come with P, and in an everchanging world of privacy that’s a key improvement.  Have you ever gotten a notification saying an app was running in the background when you didn’t think you’d been using it?  How about having an app crash in the background even though you haven’t opened it in ages?  That’s never a good thing to see.  P will prevent idle apps from performing actions such as accessing your camera (yes this is a thing!!).  P offers a series of security upgrades that limit what apps can do in the background in an effort to help protect user privacy.

How to get P?

First off, I’m so ready to stop calling it P and use it’s actual name. Unfortunately we’ll have to wait a little longer for that.  But if you want to get the beta on your phone today you can check it out on Android’s developer website here.  Give it a try and let us know your thoughts on it!  We’ll be sure to continue writing about developments in the software, so stay tuned for more.

 

 

 

Oreo: Coming Soon To A Phone Near You?

Share if the site was helpful

Oreo: Coming Soon To A Phone Near You?

It’s been just over 10 months since Android’s newest version (Oreo) began rolling out to devices. Almost a year, so let’s take a second to see how it’s doing. Well…it may be performing really well in terms of quality, but quantity is lacking.

How bad are we talking?

Every month Google releases Android’s distribution numbers showing how many devices are running each version of their operation system, and according to July’s numbers this year Oreo is active on 12.1% of active devices. As a point of reference, that puts Oreo at the 4th place position behind Nougat, Marshmallow, and Lollipop. There’s no denying this is a pretty sluggish speed for rolling things out (but to be fair it’s 0.4% ahead of where Nougat was during it’s growth phase).

So the trends show that new Android versions typically take more than a year to become the most used release, but this begs the question of why? Oreo offers some pretty cool new features such as picture in picture app usage and notification channels. Apart from battery life there aren’t too many reasons user’s would want to avoid upgrading to the newly offered software. But the issue is that it’s not actually offered to all users. There have been rollout calendars following which phones have adopted Oreo since it’s release, and the list of devices has grown slowly up until this month.

It’s Not The User’s Fault

A large part of why device updates are so slow is how fragmented the Android market currently is. Manufacturers often won’t bother with updating older pieces of hardware because it takes time and energy on their part that isn’t being put towards everything new. The end result is user’s being left high and dry. Even some new devices are hesitant to adopt the new software until it’s tried and true. User’s are able to flash their devices and test out other softwares if they so desire, but it’s not exactly mainstream to do so (as cool as it is!)

The bright side is that if you look at things over time they’re starting to ramp up exponentially. 5 months ago Oreo’s adoption rate was hovering around 1% (5 months after it’s release). Things were looking abysmal then even compared to other version’s growth rates, but thanks to a wave of updates this past month things are starting to look back on track.

Statistics Aren’t Perfect

It’s also important to note that the Android Developer dashboard I linked above relies heavily on Google’s Play Store to collect its data. This means that not every device running a version of Android is actually being accounted for in these numbers. The Play Store currently isn’t available in China (A $35 billion/year app market to be missing), and there are a few other factors at play attributing to uncounted devices. All the same it’s clear that Oreo is at about the same speed of rolling out as Nougat was, and we’ll likely see it enter the top 3 within the next few months. I for one am already looking forward to Android P though 🙂

Have you gotten Oreo on your device yet? What are your thoughts on either it’s performance or it’s rollout speed? Let us know in the comments below!

Google Fined…For Giving Users Google?

Share if the site was helpful

Google Fined…For Giving Users Google?

 

Almost everyone worldwide knows about the divide between Android and iOS.  How could you not? We hear people brag about how their operating system is in every way superior to the other and people are fools for giving business to the other end of the spectrum.   But competition happens on different tiers and the E.U. recently decided that Google has been unfairly monopolizing the market.  The cost of this? $5 billion.

Some background:

The E.U has fined Google a record €4.34bn for its use of the Android operating system to “illegally cement its dominant position” in search.  The argument goes that while Google has competition on the highest tier of competition (Android vs iOS), once a user chooses to purchase an Android phone their options are severely limited.  As a phone manufacturer if you want the Google Play Store on your phones (which you definitely do), then you also have to take the Chrome browser and Google Search along with it.

Google operating systems coming preloaded with their own associated software…sounds unfair right?  Margarethe Vestager, The European Commissioner for Competition, says that it is.  Vestager argues that Google’s withholding of the Play Store except as a package deal essentially locks down the market for other search engines.  Google has also made payments to large manufacturers as part of an agreement to exclusively pre-install the Google Search app on their devices.

The commissioner has acknowledged that Android in no way forbids users from downloading other browsers if their interested (last year Opera Mini and Firefox were downloaded more than 100 million times).  She asserts that this is far too small though since few people take the action to actively change their default settings.   Google holds the real decision making power, a sign of monopoly, not free markets.

Google’s response:

So we have competition at the operating system level, and competition at the browser level.  Google has responded saying that there’s a level far more important to the world: the app level.  While the Google Play Store is owned by Google, millions of developers contribute and share their creations on it.  Sundar Pichai, Google’s CEO, released a written statement yesterday explaining how unjust the E.U. sanction really is, as Google has taken steps to encourage a competitive market.

“Rapid innovation, wide choice, and falling prices are classic hallmarks of robust competition and Android has enabled all of them,” he wrote.  With such a small barrier to entry for developers/companies who want to share their apps with the world, Android should be seen as a free market advocate, not a giant that is terrorizing our decisions.

This is where tiers of competition become crucial in the discussion.  Does google have a fair amount of competition as an operating system?  Do they have competition as a search engine/browser?  Does their Play Store have other serious contenders trying to take its place?

How hard is it to Switch?

Sundar pointed out (with a short video), that user’s can delete their default browser and download another (such as Opera Mini) within 30 seconds.  Hardly a barrier to entry in terms of difficulty.  The monopoly discussion then becomes is it reasonable to ask users to take this course of action to be presented with other options.  100 million people is a lot, but out of 2 billion worldwide android user’s it’s not a majority.  Still, if users want to find another service, the options are there.

As crazy as it is, $5 billion is a raindrop in Google’s budget.  But it’s not really about the money (yes it is…), it’s about the image that Android upholds.  As a developer that has shared my creations on the Play Store I’ve seen it encourage users to build and share with the world.   Google is an industry giant, of that there is no doubt, and Sundar signed off saying that they intent to appeal.  Stay tuned and we’ll be sure to write about where things go from here.

What are your thoughts on Google’s role as a Monopoly terror or a free market advocate?  Let us know in the comments below!

Apps Need Room To Breathe!

Share if the site was helpful

Apps Need Room To Breathe!

Android is a complex operating system.  There’s a lot more variable when developer for Android.  Things are unpredictable when it comes to knowing what phone your user will be on.  There’s literally no limit to how many different kinds of phones could be running Android on a given day.  If you don’t know what you’re doing this can be dangerous for your layouts.

How so?  Doesn’t everything work the same from phone to phone?  Well, no actually.  Things function very similarly, but different phones have different characteristics that can drastically change a user’s experience.  Take screen size for example.  You could design an app and have one user download it on a phone with a 4’’ screen and another on a 6’’ screen.  This may not sound like a huge difference (2 inches is rarely a big decider life), but when it comes to a screen size that’s literally 50% more screen space on one device than another!

How things can go very, very wrong:

If you don’t take different screen sizes into account, then users will most likely miss out on important info. When you’re first learning about how to develop Android apps you’ll most likely use LinearLayout a lot to organize your apps.  This layout takes one view (text, image, button, etc.) and then lines up the next one in a list side by side.  Or you can change it to go vertically.  Either way the end result is a neat row/column of views.  Here’s an image to help you visualize:

But what happens if when your developing you only test the layout on your phone (let’s assume its huge).  Things may look great to you, but when you publish the app and someone with a smaller phone uses it this is what they might see:

How we can prep for things to go very, very wrong:

Trust me as I made this mistake on the first app I ever published: It’s not a fun mistake to make.  Your app is a work of art.  It’s something that you created from nothing and want to show off to your friends, family, and the world.  So when you have someone download it and instantly their greeted with a funky looking layout…well it’s not the best feeling.  Luckily, we can learn from our mistakes and prep for them in the future!

There are situations where you want to use LinearLayout and there are situations where its best to avoid it.  Sometimes you may want to keep the row/column but add scrolling capability to it instead.  Android developers have experienced all these scenarios, and that’s why there’s more options than just LinearLayout.

Layouts like ConstraintLayout and RelativeLayout allow you to position views in relation to one another as well as to their parent.  So you could position pictures on your screen to “attach” to the right or left side, and make your layout look a lot more professional.  That’s of course just the tip of the iceberg though.  There are different screen densities to account for when choosing what images to use.  And you can also have portions of your screen appear/disappear by using fragments. Don’t worry we’ll have posts on both of these topics coming up soon!

If you’re interested in learning more about styling your apps for different screen sizes and how to make your layouts ready for professional use, checkout Phonlab’s Android App Developer course!

 

Google Pay: Caring Is Sharing

Share if the site was helpful

Google Pay: Sharing Is Caring

Earlier this year Android Pay and Google Wallet combined forces to create Google Pay, a one-step payment process for Android users.  The app has featured online payments with certain websites/apps by initially linking a credit card and then checking out in the future with one click. More technologically impressive it uses NFC (Near Field Communication) to allow users to hold up their phone at a cash register and buy things in person too.

Google Pay seeks to make users lives easier by removing the hassle of reaching into you wallet/entering checkout info every time you buy something.  Yet the adoption rate for it has been…sub-optimal.  So far we’ve seen about 6% of total smartphone users give Google Pay a try.  It’s a growing number, but it’s still not very big.  If it’s because Google Pay doesn’t do enough for users, then it may start growing faster.

So what’s new?

Today Google announced some new features for the app that make it more useful.  The biggest of these is that you can now use Google Pay to send money to friends.  With apps like Venmo, PayPal, and the CashApp this is nothing new, but it’s necessary for the Google Pay to become relevant as it’s one of the primary ways younger generations pay one another.

And if you haven’t used cash sharing apps like these before GET ONE.  They’re essentially the staples easy button for splitting bills at restaurants and paying back friends.   Google Pay has a challenge of gaining traction in this sector since there are already a few established apps and sharing apps are only as useful as their adoption rate.  But then again, it’s Google and they choose what apps comes preloaded on Android phones.  Chances are they’ll be alright.

But wait there’s more!

Another new upgrade for the app is that it will be supporting boarding passes and event tickets.  Companies like Southwest and Ticketmaster will be incorporated into the app to allow users to take one step closer to a one-stop shop.  These tickets will update with real time information if something like a flight delay takes place, and they’ll work alongside any loyalty cards you have.

The updated Google Pay app is rolling out today, but it will be a few weeks until it reaches everyone who uses it.  The long term goal is clearly for Google Pay to become your go to app for any circumstances. I’m certain we’ll see some more new features come up in the news soon, and I’m also sure you’ll be able to read about them here!

What are your thoughts on Google Pay’s changes?  Is it still lacking something essential for success?  Let us know in the comments below.

The Six Degrees Of Activity Lifecycles

Share if the site was helpful

The Six Degrees Of Activity Lifecycles

As an Android developer, one of the most fundamental concepts that you’ll learn about is Activities.  Activities are a Java class that focus on a single thing that users can do.  Many involve user interactions, and in most apps on your phone you can think of each page of the app as an activity.  Open Gmail and see your list of recent messages? Activity.  Click on one of those messages to open it in a new page?  Activity.

Activities are everywhere in Android development, yet many developers that are just starting out don’t fully understand how they function.  You might be able to get by without a full understanding, but this can be lethal to your app as it expands and becomes more complicated.  Lack of understanding opens up Pandora’s box for things to go wrong with memory leaks and debugging errors down the road.

Diving In:

So let’s take a blog post to discuss the Activity Lifecycle in a little detail.  We won’t get stuck in the weeds, but cover the basics enough that you understand what’s going on under the hood and can prep for smooth app development.

Just like humans have a lifecycle from birth to death, apps have a lifecycle they follow from when their first launched to when the user closes them.  There are six methods that can be called to change the state of an activity in Android:  onCreate(), onStart(), onResume(), onPause(), onStop(), and onDestroy().  At first glance these may seem similar if not identical to one another, but understanding the differences is key to a successful user experience.

onCreate():

This is the first of the 6 lifecycle methods called in an activity, and its invoked when (you guessed it) the activity is created.  In this method startup logic that should only happen once during an activity’s life takes place.  Examples of this might be to bind data to a list, or to instantiate class-scope variables.  The bottom line is that this is called once and only once.

onStart():  

Immediately after onCreate() comes onStart(). The start state of an activity occurs when it is made visible to the user.  This is where logic goes to prep the activity to enter the foreground and become interactive.  In other words the User Interface (UI) is taken care of here.

onResume():

Yes I know, it’s three different methods whose names make it sound like they all do the same thing.  Here’s the key difference with onResume() though.  onResume is called when an app has already been created and comes into (or back into) the foreground.  An activity is constantly interactive as long as it’s in the foreground for the user.

But what if your app includes a pop up message over the activity?  Well now that pop up has the foreground.  Your activity from before will enter the onPause() state (keep reading!) until that pop up goes away.  Once it does your app will resume, and thus the onResume() method will be called again.   For example, let’s say your playing a game and an alert interrupts it.  Obviously we don’t want the game to keep going when the user can’t see it, because that would be incredibly frustrating when the user returns and finds out they died while they were way.   So we call onPause() when an activity loses focus and certain resources need to either be cleared or put on hold.

onPause():

There’s really not too much more to this one other than what I said before.  It tags in and out with onResume() to create/delete resources when needed depending on if a user has focus.  It’s where the magic happens if you do things right, and where things go noticeably wrong if you don’t.

onStop():

When your activity is no longer visible, it has stopped.  This is different from onPause() in that your activity is entirely shrouded.  Instead of a pop-up that might cover half of the screen, a new activity may have taken place and covered your current one completely.  This is essentially where the app has can completely remove unused resources that the user won’t need when returning to the activity again.

onDestroy():

And finally comes our 6th method that wraps everything up.  This is called right before an Activity is destroyed, and as such you want nothing left hanging around.  If you forget to close up a loose end in onDestroy(), your app may begin to suffer from memory leaks and eventually bog things down.  Bottom line is that all resources should be released here if they weren’t in onStop().

These 6 methods essentially bounce the user between the two states of in the user’s foreground and in their background, but there are intricacies that go a lot deeper between them.  As such properly knowing when to implement each of them can be a life saver for your apps, and a huge time saver for you when you’re building things out and want to know what’s going wrong.

If you felt lost at all along the way of this blog, then you should check out Phonlab’s Android App Developer Course!  It’s a great way to go from writing your very first line of code up to publishing our own apps on the Play Store.