Reader small image

You're reading from  Android High Performance Programming

Product typeBook
Published inAug 2016
Reading LevelBeginner
PublisherPackt
ISBN-139781785288951
Edition1st Edition
Languages
Tools
Right arrow
Authors (3):
Emil Atanasov
Emil Atanasov
author image
Emil Atanasov

Emil Atanasov is an IT consultant with broad experience in mobile technologies. He has been exploring the field of mobile development since 2006. Emil has a MSc in Media Informatics from RWTH Aachen University, Germany and a MSc in Computer Science from Sofia Unversity "St. Kliment Ohridsky", Bulgaria. He has worked for several huge USA companies and has been a freelancer for several years. Emil has experience in software design and development. He was involved in the process of redesigning, improving and creating a number of mobile apps. Currently, he is focused on the rapidly growing mobile sector and manages a great team of developers that provides software solutions to clients around the world. As an Android team leader and project manager, Emil was leading a team that was developing a part of the Nook Color firmware -a e-magazine/ e-book reader, which supports the proprietary Barnes & Nobel and some other e-book formats. He is one of the people behind the "Getting Started with Flurry Analytics" book. He also contributed largely to the book "Objective C Memory Management". "I want to thank my family and friends for being so cool. Thank you for supporting me even though I'm such a bizarre geeky person, who is spending most of the time in the digital world. Thank you, guys!"
Read more about Emil Atanasov

Enrique López Mañas
Enrique López Mañas
author image
Enrique López Mañas

Enrique Lpez Maas is a Google Developer Expert and independent IT consultant. He has been working with mobile technologies and learning from them since 2007. He is an avid contributor to the open source community and a FLOSS (Free Libre Open Source Software) kind of guy, being among the top 10 open source Java contributors in Germany. He is a part of the Google LaunchPad accelerator, where he participates in Google global initiatives to influence hundreds of the best startups from all around the globe. He is also a big data and machine learning aficionado. In his free time he rides his bike, take pictures, and travels until exhaustion. He also writes literature and enjoys all kinds of arts. He likes to write about himself in third person. You can follow him on Twitter (@eenriquelopez) to stay updated on his latest movements.
Read more about Enrique López Mañas

Diego Grancini
Diego Grancini
author image
Diego Grancini

Diego Grancini has a degree in telecommunications and IT engineering from Perugia University. He has developed his skills on Android development for more than six years leading and contributed to several projects, teaching and sharing his skills during his career. He joined Engineering Ingegneria Informatica S.P.A. after his degree, defining his own knowledge about Java and Android development working as the lead Android developer for years. Then he joined J.P. Morgan & Chase, strengthening his skills about security and performance in software development and Android platform in particular.
Read more about Diego Grancini

View More author details
Right arrow

ANR and delays in software


ANR stands for Application Not Responding, and is one of the several nightmares of an Android developer. The Android operating system analyzes the status of apps and threads, and when certain conditions are met it triggers an ANR dialog, blocking the user from any interactive experience. The dialog announces that the application stopped responding, and is not responsive anymore. The user can select whether he/she wants to close the application, or keep waiting until the application becomes responsive again (if this ever happens):

What triggers ANRs and how can I avoid them?

Android systems trigger ANRs in two different situations:

  • When there has been no response for an event in five seconds

  • If a BroadcastReceiver is still executing 10 seconds after its execution

This happens mostly when an operation is being executed in the UI Thread. In general, any operation expected to be time- or operation-consuming should be performed in a separate thread, keeping the UI Thread available for the user interaction, and only notifying the UI Thread when the operation has been finished. In Chapter 5, Multithreading, we will show some advanced techniques for multithreading and thread communication. There are also different classes that can be used to perform operations in different threads, each of them with its own advantages and disadvantages. In general, when developing an application, remember: ANR dialog appearance frequency is inversely proportional to user satisfaction.

Previous PageNext Page
You have been reading a chapter from
Android High Performance Programming
Published in: Aug 2016Publisher: PacktISBN-13: 9781785288951
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (3)

author image
Emil Atanasov

Emil Atanasov is an IT consultant with broad experience in mobile technologies. He has been exploring the field of mobile development since 2006. Emil has a MSc in Media Informatics from RWTH Aachen University, Germany and a MSc in Computer Science from Sofia Unversity "St. Kliment Ohridsky", Bulgaria. He has worked for several huge USA companies and has been a freelancer for several years. Emil has experience in software design and development. He was involved in the process of redesigning, improving and creating a number of mobile apps. Currently, he is focused on the rapidly growing mobile sector and manages a great team of developers that provides software solutions to clients around the world. As an Android team leader and project manager, Emil was leading a team that was developing a part of the Nook Color firmware -a e-magazine/ e-book reader, which supports the proprietary Barnes & Nobel and some other e-book formats. He is one of the people behind the "Getting Started with Flurry Analytics" book. He also contributed largely to the book "Objective C Memory Management". "I want to thank my family and friends for being so cool. Thank you for supporting me even though I'm such a bizarre geeky person, who is spending most of the time in the digital world. Thank you, guys!"
Read more about Emil Atanasov

author image
Enrique López Mañas

Enrique Lpez Maas is a Google Developer Expert and independent IT consultant. He has been working with mobile technologies and learning from them since 2007. He is an avid contributor to the open source community and a FLOSS (Free Libre Open Source Software) kind of guy, being among the top 10 open source Java contributors in Germany. He is a part of the Google LaunchPad accelerator, where he participates in Google global initiatives to influence hundreds of the best startups from all around the globe. He is also a big data and machine learning aficionado. In his free time he rides his bike, take pictures, and travels until exhaustion. He also writes literature and enjoys all kinds of arts. He likes to write about himself in third person. You can follow him on Twitter (@eenriquelopez) to stay updated on his latest movements.
Read more about Enrique López Mañas

author image
Diego Grancini

Diego Grancini has a degree in telecommunications and IT engineering from Perugia University. He has developed his skills on Android development for more than six years leading and contributed to several projects, teaching and sharing his skills during his career. He joined Engineering Ingegneria Informatica S.P.A. after his degree, defining his own knowledge about Java and Android development working as the lead Android developer for years. Then he joined J.P. Morgan & Chase, strengthening his skills about security and performance in software development and Android platform in particular.
Read more about Diego Grancini