Developing for Android devices demands to be clear on several concepts that go from hardware to the system’s architecture. That’s why it is always recommended to check the specific knowledge a programmer needs to have to be assigned to a project, because judging him for not having knowledge about some of the Android’s core components would be quite unfair.
For this reason, the following questions will only be good for orienting the interviewer about basic, intermediate and advanced concepts. After this, it is recommended to evaluate the candidate with a technical test, in order to prove he has the necessary capabilities to build the specific features that the application requires.
1. What is ContentProvider and what is it used for?
It is a way of providing the applications with content, this is done by encapsulating data and making it available in the applications through a ContentResolver. One of the most common examples is when it is necessary to share the access with the information contained inside a SQLite database, because these are initially private and accessible only from the application itself.
2. What are some common uses for an Intent?
Some cases in which we can use Intent are:
To initiate an Activity: it is achieved through the startActivity() method.
To initiate a service: this is possible with the startService() method.
To send a broadcast: you can send a broadcast to other applications with different methods such as sendBroadCast().
3. What is JobScheduler? In which cases can it be used?
It is an API that works for programming several types of tasks when a set of predefined conditions is met. It is quite common to use it for the following types of tasks:
Tasks that need to be done once the device has been connected to a power source.
Tasks that require network access or Wi-Fi connection.
Tasks that should be executed in a regular way and where time is not something critical.
4. What are Android’s lifecycle main 6 callbacks?
The lifecycle refers to the different states that an activity passes through in an Android application. This lifecycle is composed of 6 events:
onCreate(): it is initiated when the Activity is created.
onStart(): this method is called when the Activity is visible to the user.
onResume(): it is executed when the Activity is in the foreground and the user can interact with it.
onPause(): it is executed when the activity loses focus or is no longer in the foreground.
onStop(): it gets activated when the Activity is completely hidden and is non visible to the user.
onDestroy(): In the last stage, the Activity is destroyed and eliminated from the memory.
5. What is the relation between a Fragment and an Activity? Explain the relation between them
An activity is usually an operation focused on a user being able to perform an action, even though these can be really complex, the activities can use the class Fragment so they can produce a more modular code.
A fragment is an activity’s section, that has its own lifecycle and events, however, when the activity’s lifecycle is affected, also the fragment’s lifecycle is affected; therefore, if the activity gets paused so will the fragment.
6. What are fragments and what uses do they have?
They are reusable parts of the user’s interface of an application. Fragments have their own design and they administer a lifecycle that’s separate from the activity in which they are declared at. They can be used to pass information between screens and organize the user’s interface.
7. What are the different ways of implementing a DataStore?
A DataStore is a way of doing data persistence and it has two ways of being implemented:
Preferences DataStore: uses objects of the key type - value to store the information and it does not need to previously define a data scheme.
ProtoDataStore: it stores data as instances with custom types of data and they require a scheme to be defined previously.
8. What are the fundamental blocks from an Android application?
The main components of an Android application are four:
Activities: it is the point of entry in which the user can interact with the application.
Services: it is a component executed in the background in order to perform long-term operations or performing remote processes. They do not have a user’s interface.
Broadcast receivers: it allows the system to send events to the application outside of an user’s regular flow.
Content providers: It administers a shared set of data and it can be used to do data persistence.
9. What is the difference between the Activities and Services?
An activity is an user’s interface and a service is a process that constantly runs in the background and does not have a GUI.
10. What does it mean to make a “Lazy First” application?
It means the application will seek different ways of reducing and optimizing the operations that have a bigger battery use. This is achieved by different ways, for instance, storing downloaded data in cache instead of repeatedly downloading them each time they’re used.