Mad QB Ans
Mad QB Ans
What is ImageButton?
An ImageButton is a button that displays an image instead of text. It functions like a regular Button but uses an icon or
picture for user interaction.
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<ToggleButton
android:id="@+id/tg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textOff="OFF"
android:textOn="ON" />
</LinearLayout>
Java File:
package com.example.myapplication;
import android.os.Bundle;
import android.widget.ToggleButton;
import android.widget.Toast;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import android.bluetooth.BluetoothAdapter;
tg.setChecked(ba.isEnabled());
tg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(tg.isChecked())
{
ba.enable();
Toast.makeText(MainActivity.this,"Bluetooth is on",
Toast.LENGTH_LONG).show();
}
else {
ba.disable();
Toast.makeText(MainActivity.this,"Bluetooth is off",
Toast.LENGTH_LONG).show();
}
}
});
}
}
Use in XML:
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/my_image"/>
Use in Java/Kotlin:
imageView.setImageResource(R.drawable.my_image);
imageView.setImageResource(R.drawable.my_image)
For large images, use res/raw or assets.
RadioButton(Context context)
RadioButton(Context context, AttributeSet attrs)
setChecked(boolean checked)
isChecked()
toggle()
setText(CharSequence text)
getText()
setTextColor(int color)
setEnabled(boolean enabled)
5) RadioButton
Xml file:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Single Radio Button"
android:textStyle="bold"/>
<RadioButton
android:id="@+id/radioButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Radio Button 1"/>
<RadioButton
android:id="@+id/radioButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Radio Button 2"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Radio button inside RadioGroup"
android:textStyle="bold"
android:layout_marginTop="10dp"/>
<RadioGroup
android:id="@+id/radioGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RadioButton
android:id="@+id/radioMale"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Male"/>
<RadioButton
android:id="@+id/radioFemale"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Female"/>
</RadioGroup>
<Button
android:id="@+id/buttonShow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SHOW SELECTED"
android:layout_marginTop="10dp"/>
</LinearLayout>
Java File
package com.example.myapplication;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
radioButton1 = findViewById(R.id.radioButton1);
radioButton2 = findViewById(R.id.radioButton2);
radioMale = findViewById(R.id.radioMale);
radioFemale = findViewById(R.id.radioFemale);
radioGroup = findViewById(R.id.radioGroup);
buttonShow = findViewById(R.id.buttonShow);
buttonShow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String selected = "";
if (radioButton1.isChecked()) {
selected += "Radio Button 1\n";
}
if (radioButton2.isChecked()) {
selected += "Radio Button 2\n";
}
if (radioMale.isChecked()) {
selected += "Male\n";
}
if (radioFemale.isChecked()) {
selected += "Female\n";
}
if (selected.isEmpty()) {
selected = "No selection";
}
Xml File
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
android:padding="20dp">
<ProgressBar
android:id="@+id/circularProgressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true"/>
</LinearLayout>
Java File:
package com.example.myapplication;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
7) Attributes of ImageView
Important Attribute:
Definition:
The android:stretchMode attribute is used in GridView to define how columns should expand to fill the available space.
Usage:
<GridView
android:id="@+id/gridView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:numColumns="auto_fit"
android:stretchMode="columnWidth"/>
1. none (Default)
o No columns are stretched.
o The column width remains fixed.
2. spacingWidth
o Extra space is distributed as padding between columns.
o Column width remains the same.
3. columnWidth
o Extra space is added to the columns, making them wider.
o Best when using numColumns="auto_fit" to adjust dynamically.
4. spacingWidthUniform (API Level 26+)
o Like spacingWidth, but ensures equal spacing across all columns.
When to Use:
9) ScrollView
ScrollView is a view group used to make content scrollable when it doesn’t fit on the screen. It supports vertical
scrolling by default, while HorizontalScrollView enables horizontal scrolling. It is commonly used for long forms, large
text content, or images. Since it can have only one direct child, use a LinearLayout to arrange multiple views inside it.
ScrollView ensures smooth scrolling for a better user experience.
Attributes:
android:layout_width – Sets the width of the ScrollView (e.g., match_parent, wrap_content).
android:layout_height – Defines the height of the ScrollView (match_parent allows full-screen scrolling).
android:fillViewport – If set to true, forces child views to expand and fill the viewport.
android:background – Sets the background color or drawable of the ScrollView.
android:scrollbars – Controls scrollbar visibility (vertical, horizontal, or none).
android:fadingEdgeLength – Defines the size of the fading effect when scrolling.
android:overScrollMode – Controls the overscroll effect (always, ifContentScrolls, never).
For Example:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@android:color/white">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/scrolltext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="24sp"
android:text="This is a sample scrollable text. Add more lines here to test scrolling."
android:textColor="@android:color/holo_green_dark"/>
</ScrollView>
</LinearLayout>
Alerts provide a quick and clear notification to the user about important actions or information, such as errors,
warnings, or confirmations.
Example: Showing a warning when the user tries to exit an unsaved form.
2. Feedback on Actions:
Alerts are used to give immediate feedback on a user's actions (e.g., successful submission or failure to
complete an action).
Example: A success message after a successful login.
Alerts prompt user decisions by presenting buttons for confirmation, like "OK," "Cancel," or "Yes/No."
Example: Asking users to confirm before deleting a file.
4. Improve UX:
They help improve user experience by guiding users and keeping them informed about the app's state, ensuring
they don't miss important information.
Example: Informing users of network issues when the app cannot fetch data.
5. Error Handling:
Alerts are important for handling errors gracefully by informing the user and often providing options to correct
or report the issue.
Example: Displaying an error when an incorrect input is provided (e.g., invalid email format).
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:id="@+id/textViewContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="100sp"
android:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Pellentesque euismod, nisi eu consectetur convallis, nunc risus ultrices
orci, sed vehicula erat purus nec quam. Vestibulum ante ipsum primis in
faucibus orci luctus et ultrices posuere cubilia curae; Integer tincidunt,
justo vel consectetur tempus, libero lorem ultricies nunc, eget faucibus
velit neque a felis. \n\n
(Add more text here to make it scrollable...)"
android:scrollbars="vertical" />
</LinearLayout>
</ScrollView>
Java File:
package com.example.scrollview;
import android.os.Bundle;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
xml file:
Java :
package com.example.myapplication;
import android.app.DatePickerDialog;
import android.app.TimePickerDialog;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import java.util.Calendar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
txt1 = findViewById(R.id.txt1);
txt2 = findViewById(R.id.txt2);
txtage = findViewById(R.id.age);
btn1 = findViewById(R.id.btn1);
btn2 = findViewById(R.id.btn2);
btn1.setOnClickListener(v -> {
Calendar c = Calendar.getInstance();
int y = c.get(Calendar.YEAR);
int m = c.get(Calendar.MONTH);
int d = c.get(Calendar.DAY_OF_MONTH);
btn2.setOnClickListener(v -> {
Calendar c = Calendar.getInstance();
int h = c.get(Calendar.HOUR_OF_DAY);
int min = c.get(Calendar.MINUTE);
1. Syntax of Intent-Filter.
Syntax:
<intent-filter
android:icon="drawable resource"
android:label="string resource"
android:priority="integer" >
...
</intent-filter>
2. Activity Lifecycle
1. onCreate() – This method runs when the activity starts for the first time. It is used to set up the screen layout
and initialize variables. This is where you create buttons, text fields, and other UI components. It runs only once
when the activity is created.
2. onStart() – This method runs when the activity becomes visible to the user. It is called after onCreate(), or when
returning to the activity from the background. At this stage, the user can see the activity, but it might not yet be
interactive.
3. onResume() – This method runs when the activity is fully visible and the user can interact with it. This is where
animations, media playback, or sensors should start running. If the app was paused, this method restarts those
processes.
4. onPause() – This method runs when the activity is partially hidden (e.g., a pop-up appears). It is used to pause
the things like music or animations to save battery and performance. The activity is still in memory but not fully
active.
5. onStop() – This method runs when the activity is no longer visible on the screen. The system may remove it from
memory if needed. It is used to stop heavy operations like network calls or database access.
6. onRestart() – This method runs when an activity is coming back from the stopped state. It is used to refresh the
UI or reload data before making it visible again. After this, onStart() and onResume() will be called.
7. onDestroy() – This method runs just before the activity is completely removed from memory. It is used to free
up resources, close database connections, or save final data. The activity cannot be restarted after this without
creating a new one.
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:gravity="center">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/edit1"
android:hint="Enter the Phone Number"
android:inputType="phone"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/edit1"
android:layout_centerHorizontal="true"
android:layout_margin="20dp"
android:text="Dial"
android:id="@+id/btn"
/>
</RelativeLayout>
Java file:
package com.example.myapplication;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
EditText number;
Button dial;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
number=findViewById(R.id.edit1);
dial=findViewById(R.id.btn);
dial.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Uri uri=Uri.parse("tel:"+number.getText().toString());
}
}
This package is essential for managing SQLite databases in Android. It provides classes like SQLiteDatabase for
executing SQL queries and SQLiteOpenHelper for handling database creation and upgrades. Another important
class is SQLiteQueryBuilder, which simplifies query building. These classes help in performing operations like
insert, update, delete, and retrieve data from the database efficiently.
2. android.database
This package contains general database-related classes and interfaces used for handling data retrieval and
manipulation. The Cursor class is the most important, as it allows reading and navigating through query results.
Another useful class is DatabaseUtils, which provides utility methods for working with databases. It helps
simplify operations like converting cursor data to strings or counting rows in a table.
3. android.content
This package is indirectly required for database operations, as it provides essential utilities for managing data.
The ContentValues class is used to store values before inserting or updating records in the database. The Context
class is crucial because it helps access and manage database files. Without these, working with SQLite
databases in Android would be difficult.
Here's a breakdown:
1. Install-time Permissions:
These permissions are declared in the AndroidManifest.xml file and are granted to the app during installation.
Examples include INTERNET, READ_EXTERNAL_STORAGE, and WRITE_EXTERNAL_STORAGE.
The system automatically grants these permissions, and the user doesn't need to explicitly grant them during
runtime.
2. Runtime Permissions:
These permissions require user confirmation at runtime, meaning the app must request them from the user
during app execution.
Examples include permissions related to location (ACCESS_FINE_LOCATION), camera (CAMERA), and
microphone (RECORD_AUDIO).
The user can choose to grant or deny these permissions, and the app can only access the corresponding
functionality if the permission is granted.
3. Special Permissions:
These permissions guard access to system resources that are particularly sensitive or not directly related to user
privacy.
Examples include permissions like scheduling exact alarms, displaying over other apps, and accessing all storage
data.
Special permissions are different from install-time and runtime permissions and require specific handling and
may be managed through system settings.
1. AsyncTask Methods
2. Service Methods
What is AsyncTask?
AsyncTask is an Android class used to perform background operations and update the UI without blocking the main
thread.
@Override
protected String doInBackground(Void... voids) {
return "Task Completed";
}
@Override
protected void onPostExecute(String result) {
Toast.makeText(getApplicationContext(), result, Toast.LENGTH_SHORT).show();
}
}
Limitations of AsyncTask
1. Not Suitable for Long Tasks – Designed for short background tasks; long tasks may cause memory leaks.
2. Memory Leaks – If the AsyncTask holds a reference to an Activity, it may leak memory when the activity is
destroyed.
3. Limited Parallel Execution – Runs tasks sequentially (before API 11); after API 11, executeOnExecutor() is
needed for parallel execution.
4. No Proper Lifecycle Awareness – Cannot detect when an Activity is destroyed, leading to UI updates after it's
gone.
5. Deprecation in API 30 – Android has deprecated AsyncTask in favor of Executors and WorkManager.
8. Service lifecycle
1. Started
a. A service is started when an application component, such as an activity, starts it by calling startService().
b. Now the service can run in the background indefinitely, even if the component that started is destroyed.
2. Bound
b. A bound service offers a client-server interface that allows components to interact with the service, send requests, get
results, and even do so across processes with Inter Process Communication (IPC).
c. Like any other components service also has callback methods. These will be invoked while the service is running to
inform the application of its state. Implementing these in our custom service would help you in performing the right
operation in the right state.
d. There is always only a single instance of service running in the app. If you are calling startService() for a single service
multiple times in our application it just invokes the onStartCommand() on that service. Neither is the service restarted
multiple times nor are its multiple instances created.
1. onCreate(): This is the first callback which will be invoked when any component starts the service. If the same service
is called again while it is still running this method won’t be invoked. Ideally one time setup and initialization should be
done in this callback.
2. onStartCommand() /startSetvice(): This callback is invoked when service is started by any component by calling
startService(). It basically indicates that the service has started and can now run indefinitely.
3. onBind(): To provide binding for a service, you must implement the onBind() callback method. This method returns an
IBinder object that defines the programming interface that clients can use to interact with the service.
4. onUnbind(): This is invoked when all the clients are disconnected from the service.
5. onRebind(): This is invoked when new clients are connected to the service. It is called after onRebind
6. onDestroy(): This is a final clean up call from the system. This is invoked just before the service is being destroyed.
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.BLUETOOTH_SCAN"/>
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
Xml file:
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Activity Lifecycle..."
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
Java file:
package com.example.saee_17;
import android.os.Bundle;
import android.widget.Toast;
import androidx.activity.EdgeToEdge;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
public class MainActivity extends AppCompatActivity {
@Override
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_main);
@Override
super.onResume();
@Override
super.onPause();
@Override
super.onStop();
@Override
protected void onRestart()
super.onRestart();
@Override
super.onDestroy();
11. WAP to turn on, get visible, list device and turn off
Bluetooth with the help of GUI.
Xml file:
<TextView
android:text="BLUETOOTH"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textSize="20sp"
android:textStyle="bold"
android:layout_marginBottom="10dp"/>
<Button
android:id="@+id/btnTurnOn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Turn On"/>
<Button
android:id="@+id/btnVisible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Get Visible"/>
<Button
android:id="@+id/btnListDevices"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="List Devices"/>
<Button
android:id="@+id/btnTurnOff"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Turn Off"/>
</LinearLayout>
Java file:
package com.example.myapplication;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import java.util.Set;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
Button btnTurnOn = findViewById(R.id.btnTurnOn);
Button btnVisible = findViewById(R.id.btnVisible);
Button btnListDevices = findViewById(R.id.btnListDevices);
Button btnTurnOff = findViewById(R.id.btnTurnOff);
// Turn On Bluetooth
btnTurnOn.setOnClickListener(v -> {
if (bluetoothAdapter != null && !bluetoothAdapter.isEnabled()) {
startActivity(new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE));
Toast.makeText(this, "Turning On Bluetooth", Toast.LENGTH_LONG).show();
}
});
Permissions
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
<uses-permission android:name="android.permission.BLUETOOTH_SCAN"/>
<TextView
android:text="Available Sensors: "
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textSize="20sp"
android:textStyle="bold"
android:id="@+id/txt"
/>
</LinearLayout>
Java File:
package com.example.myapplication;
import android.annotation.SuppressLint;
import android.hardware.Sensor;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import java.util.List;
int i;
for(i=0;i<sensors.size();i++)
{
name.append(sensors.get(i).getName()).append("/n");
}
txt.setText(name.toString());
}
1. MAP_TYPE_NORMAL
2. MAP_TYPE_SATELLITE
3. MAP_TYPE_TERRAIN
4. MAP_TYPE_HYBRID
5. MAP_TYPE_NONE
This method sets the style of the map such as normal, satellite, or terrain. It helps in displaying the map based on your
app's need. You can choose from several predefined map types.
Example:
googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
2. addMarker(MarkerOptions options)
Adds a marker to the map at a specific latitude and longitude. Markers help show places like cities, stores, or user clicks.
You can also add a title to the marker.
Example:
3. moveCamera(CameraUpdate update)
Moves the camera to a new position on the map instantly. It is used when you want to show a certain location. No
animation is applied.
Example:
4. animateCamera(CameraUpdate update)
Moves the camera to a new location with animation. It gives a smooth zoom or scroll effect. Useful for a better user
experience.
Example:
6. clear()
Removes all markers, lines, and shapes from the map. It resets the map to an empty view. Useful when updating
location data.
Example:
googleMap.clear();
IV) Explain methods of zoom control
1. hide()
Hides a ZoomControls widget from the screen. Useful when you want to remove zoom controls manually.
Example:
zoomControls.hide();
2. show()
Shows the ZoomControls widget on the screen. Used when you want to display zoom buttons.
Example:
zoomControls.show();
3. setOnZoomInClickListener(View.OnClickListener listener)
Called when the Zoom In button is clicked. You define what happens when zoom in is pressed.
Example:
zoomControls.setOnZoomInClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
googleMap.animateCamera(CameraUpdateFactory.zoomIn());
}
});
4. setOnZoomOutClickListener(View.OnClickListener listener)
Called when the Zoom Out button is clicked. You define what happens when zoom out is pressed.
Example:
zoomControls.setOnZoomOutClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
googleMap.animateCamera(CameraUpdateFactory.zoomOut());
}
});
1. Sandboxing: Application sandboxing means each application runs independently, without access to data from
other applications until permission is granted.
2. Application Signing: Every Android app is signed with a certificate, which uniquely identifies the app and its
developer. The signing certificate allows the system and other apps to verify the authenticity and origin of the
app.
3. Permissions: Permissions control access to sensitive user data and system features. They protect user privacy
and prevent apps from interfering with other apps or the system. Permissions are categorized into different
protection levels based on their potential impact on user privacy and system security:
a) Normal Permissions
b) Signature Permissions
c) Dangerous Permissions
VII) Explain the process of getting API keys
Creating API keys
The API key is a unique identifier that authenticates requests associated with your project for usage and billing purposes.
You must have at least one API key associated with your project.
Click on the API key option to generate your API key. After clicking on this option your API key will be generated
Reverse Geocoding is the process of converting latitude and longitude into a human-readable address (e.g., street name,
city, country). In Android, Geocoder is a built-in class that provides reverse geocoding functionalities using the device's
internet connection or offline data.
For example:
Before you can publish any app on Google Play, you need to create a Developer Account. You can easily sign up for one
using your existing Google Account.
If you want to publish a paid app or plan to sell in-app purchases, you need to create a payments center profile, i.e. a
merchant account.
Now you have to create an application by clicking on 'Create Application'. Here you have to select your app’s default
language from the drop-down menu and then type in a title for your app.
Finally upload your app, by uploading APK file. Before you upload APK, you need to create an app release. You need to
select the type of release you want to upload your first app version to. You can choose between an internal test, a
closed test, an open test, and a production release.
If you don’t assign a rating to your app, it will be listed as ‘Unrated’. Apps that are ‘Unrated’ may get removed from
Google Play.
Before you can fill out the details required in this step, you need to determine your app’s monetization strategy. Once
you know how your app is going to make money, you can go ahead and set up your app as free or paid.
The final step involves reviewing and rolling out your release after making sure you’ve taken care of everything else.