1. Define Intent and List Its Types
- Intent: A messaging object used to request action from another application component.
- Types of Intents:
- Explicit Intent: Targets a specific component (e.g., starting a specific activity).
- Implicit Intent: Declares a general action to perform, allowing other apps to handle it.
2. Difference Between Implicit Intent and Explicit Intent
- Explicit Intent:
- Used to start a specific activity or service.
- Example:
```java
Intent intent = new Intent(this, SecondActivity.class);
startActivity(intent);
- **Implicit Intent**: - Used for actions such as sending emails or opening browsers. - **Example**:java
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://www.google.com"));
startActivity(intent);
```3. Define Services in Android
- Service: A component that runs in the background to perform long-running operations without a user interface.
4. Describe Service Life Cycle with its Diagram
- Service Lifecycle Methods:
onCreate()onStartCommand()onDestroy()- Diagram:
onCreate() → onStartCommand() → (Service Running) → onDestroy()5. Android AsyncTask with Example
- AsyncTask: Helps to perform background operations and publish results on the UI thread.
- Example:
java private class DownloadTask extends AsyncTask<String, Void, String> { protected String doInBackground(String... urls) { // background work return "Download complete"; } protected void onPostExecute(String result) { Toast.makeText(context, result, Toast.LENGTH_SHORT).show(); } }
6. Use of Fragments
- Fragments: Reusable UI components that can be embedded in activities, aiding in creating flexible UIs for large screens like tablets.
7. Explain Content Provider
- Content Provider: Manages access to a structured set of data and shares data between applications.
8. Explain Different Types of Animation
- View Animation (Tween): Rotate, Scale, Translate, Alpha.
- Property Animation: More flexible, animates any property of an object.
- Drawable Animation: Frame-by-frame animation using images.
9. Explain Sensor and Types of Sensors
- Sensor: Provides data about the device’s environment.
- Types:
- Motion Sensors: Accelerometer, Gyroscope
- Environmental Sensors: Temperature, Pressure
- Position Sensors: Proximity, Magnetometer
10. Develop a Program for Providing Bluetooth Connectivity
- Example:
java BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (bluetoothAdapter == null) { // Device doesn't support Bluetooth } else { if (!bluetoothAdapter.isEnabled()) { Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(enableBtIntent, 1); } }
- Example:
11. Explain Different Types of Available Sensors in Android Application with Example
- Types:
- Accelerometer: Detect motion
- Gyroscope: Detect rotation
- Proximity: Detect nearby objects
- Example Code:
java SensorManager sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); Sensor accelerometer = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
12. Write a Program to Turn ON, Get Visible, List Devices and Turn off Bluetooth with Example
- Final Example:
java BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); // Turn ON // Make Visible // List Paired Devices // Turn OFF
- Final Example:
13. Write a Program to Display MSBTE Location on the Map
- Java Code:
java LatLng msbteLocation = new LatLng(19.0176, 72.8562); mMap.addMarker(new MarkerOptions().position(msbteLocation).title("MSBTE")); mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(msbteLocation, 15));
- Java Code:
14. Develop an Application to Store Customer's Details Using SQLite Databases
- SQLite Helper Example:
java public class DBHelper extends SQLiteOpenHelper { // Create table }
- SQLite Helper Example:
15. Write an Application to Store Student Details Using SQLite Database
- SQLite Example:
java db.execSQL("CREATE TABLE student(rollno TEXT PRIMARY KEY, name TEXT, branch TEXT, marks INTEGER, percentage REAL)");
- SQLite Example:
16. Develop an Application to Send and Receive SMS
- Send SMS Code:
java SmsManager sms = SmsManager.getDefault(); sms.sendTextMessage("phoneNumber", null, "Hello", null, null);
- Send SMS Code:
17. Explain Android Security Model
- Key Security Features:
- Sandboxing
- Permissions
- App Signing
18. Enlist the Steps to Publish an Android Application
- Steps:
- Test thoroughly
- Create signed APK or AAB
- Create developer account on Play Console
19. Explain Geocoding and Reverse Geocoding with a Proper Example
- Geocoding Example Code:
```java
Geocoder geocoder = new Geocoder(this);
geocoder.getFromLocationName("MSBTE Mumbai", 1);
- **Reverse Geocoding Example**:java
geocoder.getFromLocation(19.0176, 72.8562, 1);
```- Geocoding Example Code:
20. Write a Program to a Map-Based Application to Display Current Location
- Example Code:
java LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); LatLng current = new LatLng(location.getLatitude(), location.getLongitude()); mMap.addMarker(new MarkerOptions().position(current).title("You are here"));
- Example Code: