You are on page 1of 6

Assignment 5

• Explain activity life cycle with diagram.

• Describe the significance of SQLite database in Anroid.


• Explain zoom control (IN / OUT) with the help of an example
• Describe multimedia framework of Android with diagram
• Write a program to capture an image using camera and display it
• Write a program to implement Android Activity Life Cycle. Use toast
messages to display message through life cycle
• import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
showToast("onCreate");
}

@Override
protected void onStart() {
super.onStart();
showToast("onStart");
}

@Override
protected void onResume() {
super.onResume();
showToast("onResume");
}

@Override
protected void onPause() {
super.onPause();
showToast("onPause");
}

@Override
protected void onStop() {
super.onStop();
showToast("onStop");
}

@Override
protected void onDestroy() {
super.onDestroy();
showToast("onDestroy");
}

private void showToast(String message) {


Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
}
}

• List sensors in Android and explain any one in detail.

1. Accelerometer: Measures acceleration forces along the x, y, and z axes.

2. Gyroscope: Measures angular velocity around the device's x, y, and z axes.

3. Magnetometer (Compass): Measures the device's orientation relative to Earth's


magnetic field.

4. Proximity Sensor: Detects the presence of nearby objects without physical contact.

SensorManager sm = (SensorManager) getSystemService(Context.SENSOR_SERVICE);


Sensor ps = sm.getDefaultSensor(Sensor.TYPE_PROXIMITY);

5. Ambient Light Sensor: Measures the ambient light level in the device's environment.

6. Barometer: Measures atmospheric pressure.

7. Temperature Sensor: Measures the device's internal temperature.


8. GPS (Global Positioning System): Determines the device's location using satellite
signals.

9. Fingerprint Sensor: Authenticates users by scanning their fingerprints.

10. Heart Rate Sensor: Measures the user's heart rate.

11. Pedometer: Counts steps taken by the user.

12. Humidity Sensor: Measures the humidity level in the device's environment.

13. Gesture Sensor: Detects specific gestures made by the user.

14. Rotation Vector Sensor: Provides the device's orientation in terms of a quaternion or
rotation matrix.

15. Pressure Sensor: Measures atmospheric pressure.

• Develop a program for providing bluetooth connectivity.

Assignment 6
• Discuss Developer console with its purpose

o Google Play Developer Console is the platform that Google provides for Google Play and
Android developers to publish their apps.
o The Google Play Developer console allows app developers and marketers to better
understand how their apps are performing in terms of growth, technical performance
such as crashes or display issues, and financials.
o The console offers acquisition reports and detailed analysis which can help app devs find
out how well an app is really performing.
o The platform is important as it provides developers with access to first party data
(trustworthy information collected about an app’s audience that comes straight from
Google Play) that highlights the real performance of an app.
o It shows the number of impressions an app listing receives and the number of Installs an
app receives from different sources over time.

• Develop an application to send and receive SMS. (Write ONLY .java and
permission tag in manifest file

import android.app.Activity;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends Activity {


Button sendBtn;
EditText txtPhoneNo;
EditText txtMessage;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

sendBtn = (Button) findViewById(R.id.btnSendSMS);


txtPhoneNo = (EditText) findViewById(R.id.editTextPhoneNo);
txtMessage = (EditText) findViewById(R.id.editTextSMS);

sendBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
sendSMSMessage();
}
});
}

protected void sendSMSMessage() {


String phoneNo = txtPhoneNo.getText().toString();
String message = txtMessage.getText().toString();

try {
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phoneNo, null, message, null, null);
} catch (Exception e) {
e.printStackTrace();
}
}
}

<uses-feature android:name = "android.hardware.telephony"/>


<uses-permission android:name="android.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
<uses-permission android:name="android.permission.READ_SMS"/>

• Discuss developer console with at least four features.

The Google Developer Console, also known as the Google Play Console, is a platform that
allows developers to publish their apps or games and monitor their performance on Google
Play. Here are some of its key features:
1. Upload and Publish Apps: Developers can upload and publish their apps or games
directly to Google Play.

2. Store Listings: Developers can create and modify store listings for their apps4.

3. Sales and Statistics: The console provides detailed reports and statistics about app
performance, including sales4.

4. Version Management: Developers can manage different versions of their apps4.

5. Ratings and Reviews: Developers can view and respond to user ratings and reviews4.

6. Crash Reports: The console provides crash reports to help developers improve their
apps.

7. Testing: Developers can set up open, closed, or internal tests for their apps5.

8. Monetization: Developers can create a revenue stream by launching a paid app or


offering digital content or subscriptions

• Write a program to demonstrate declaring and using permissions with any


relevant example.
• Develop an application to display Google map with user’s current location
• State permissions required for android application development.
• Name any four methods to get location data in android.
• Define Geocoding and Reverse Geocoding.
• State syntax to display built in zoom control.
• Enlist the steps to publish the Android application.
• Enlist the steps to generate API key

1. Sign in to Google Cloud console

2. Create a project and enable the Maps SDK for Android1.

3. Create an API key1:

o Go to the Google Maps Platform > Credentials page2.

o On the Credentials page, click Create credentials > API key2.

o The API key created dialog displays your newly created API key2.

o Click Close2.
o The new API key is listed on the Credentials page under API keys.

o Remember to restrict the API key before using it in production

You might also like