Android interview prep 2022: Topics/concepts to master
Have been developing mobile apps for the last 11 years and was lucky enough to recruit the best mobile developers for companies I worked for.
I believe android development needs in-depth conceptual knowledge and skills as there are always 100 ways for doing one thing unlike IOS or any other mobile development tech. For instance, to perform some tasks in the background we have plenty of options to choose from Foreground services, WorkManager, services, etc. Also, no one can deny the fact that android is an ever-evolving stack, what you know today might be deprecated in the next month and hence one should always be aware of the latest trends in the Android ecosystem.
Since this blog is dedicated to concepts/topics that one should master before appearing for an interview, I will try my best to recall all such topics that I would always expect the candidate to know :).
One more thing before we start : don’t waste your time searching for Top android question rather focus on below concepts. If your concepts are clear as water, no matter what question is thrown at you at the time of interview from topic you have mastered; you will be able to answer. Don’t just limit yourself to just top 10/50 android questions.
So let’s begin.
#1 : Lifecycle-aware components.
Android development revolves around lifecycle and we should master all android lifecycle-aware components. For beginners, understanding activity and fragment life cycle can be a great start.
Below are topics from my list that I consider asking candidates:
a. ViewModels :
Sharing viewModel between fragments.
Sharing viewModel between Navgraph.
How to pass parameters to viewModel constructor.
What is ViewModelStore.
b. LiveData , flow (StateFLow , SharedFlow etc.)
In-depth knowledge on how LiveData works.
Difference between liveData and flow. (Check this blog to to read more about LiveData ,Flow and to understand when and where to use .)
Cold and hot streams. (Read about best ways to collect them)
Common issues with LiveData and how to solve them. (Read about EventLiveData and SingleLiveData wrapper ).
Transformations on LiveData.
#2 : Networking.
Since most of the apps would interact with the cloud to sync data and hence it makes sense to rate the candidate based on his/her conceptual knowledge of networking-related concepts. Below are the most common ones that candidates should always consider revisiting before an interview :
In-depth knowledge of OkHttp and widely used lib retrofit.
Interceptors (Login, TokenAuthenticator etc ).
Cache API calls.
How would you handle token expiry while making network calls?
Error handling. (Check google code labs for this).
SSL pinning and other network security related concepts like (
android:usesCleartextTraffic
)
#3. Architecture and design patterns:
That’s the foundation for any project we work with and hence it's worth considering rating the candidate for the same.
There are plenty to choose from and most commonly and widely accepted nowadays is :
MVVM
MVVM + Clean
MVP
The best place to learn and practice these architecture's patterns is google code labs.
Now, let see what sort of concepts one should master related to architecture.
How would you decide which architecture pattern to choose from?.
Make sure you know pros and cons for all commonly used patterns.
Interviewer might ask you to explain one user flow (for instance login )touching all layers in your architecture : here candidate should put forward all different layers that he would consider i.e UI , repository , domain , use cases etc.
Why is it bad to have android context passed to viewModels and other layers below UI/presentation ?.
Singleton design pattern and where would you use it.
#4. Dependency Injection frameworks.
Since we talked about architecture/design patterns that are used to decouple modules/layers so that unit testing can be done easily and independently of any module, we cannot ignore the core contributor in writing a great and testable architecture: Dependency injection.
What exactly is dependency injection and why its important?
Before directly jumping to dagger2/hilt or koin frameworks, try to understand the very basic of dependency injection. (Search for Car and Engine example at google, you will find a multiple blogs explaining the need of dependency injection).
Make sure you know the basic of dagger2/Hilt or koin frameworks and how they work under the hood.(pros and cons for all framework you know).
Dependency graph concepts.
Basic annotation for Dagger/Hilt Qualifier, scopes, providers , binds etc. Injecting viewModels.
How do you inject repositories (using Binds wherein u bind implementation of interface )
Custom Scopes for Activity , fragment )
#5. Security concepts
While working with android we need to store some tokens within the device and sometimes a few tokens in code. It makes sense to rate a candidate based on his/her knowledge of security.
Encryption and encoding difference?
SHA, AES, Base64: where and when to use these.
Encrypted shared preference and how does it work.
Where do android stores secure Keys?.
How to securely keep secrets in code (At times, we have to keep secrets in code or gradle files. for instance: firebase key, google secrets, algolia secrets etc.)
#6. Threading concepts
This is the most crucial one as lacking knowledge in this would result in writing code that would yield ANRs most of the time. Android have had been rapidly improving in this area as a legacy developer would understand it was AsyncTask/handlers before to perform thread related tasks and also Intent services etc. But now, threading has been relatively easy but more confusing if you don't dive deep into core concepts.
Considering the latest trends in this area, below are a set of topics that should be considered in go thorough list before the interview
Work manager: Why and where to use? Read about how it works internally and also how it reacts to doze mode.
Foreground service. Read all the latest updates on this as we can no longer start them from the background.
Coroutines: This is the latest on the list and one should consider reading and playing with this a lot. Particularly below topics:
What is structured concurrency? (Read about supervisorScope and corountineScope).
What are suspend functions? How coroutine works under the hood.
Running two jobs in parallel. (Read about async/ deferred jobs).
Catching exceptions in a coroutine.
SuspendCoroutines and runblocking.
And lastly, the below topics are also worth considering for interview preparation:
Unit test cases.
ViewBinding/DataBinding.
BindingAdapter.
RecyclerView, PagingAdapter , DiffUtils.
Framelayouts, ConstraintLayouts.
NavigationGraph (Focus more on backStack related concepts, argument passing, default arguments).
Please note this blog I focused more on android related topics and most likely interviewer would certainly evaluate the candidate for other important skills as well, some of them are listed below :
Command over kotlin language.
Oops concepts.
Data Structures.
(Let me know in the comments if you want me to cover the above topics in detail.)
And lastly, i would conclude this blog with a great quote from Socrates.
“I cannot teach anybody anything. I can only make them think.”
Thank you :)