Skip to content
AD-703 (B) · Mobile Application Development/Quick Revision Short Notes

Mobile Application Development (AD-703 (B)) - Unit 5 Short Notes

How unit 5 is examined

This unit covers the storage, database, sharing, network, web, telephony and publishing APIs of Android; no past question has been asked recently, so learn each definition and its key points.

Using Android Data and Storage APIs

<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>

Definition. <mark>Android provides Shared Preferences, internal storage, external storage and SQLite so that an app can save data persistently.</mark>

Key points.

  1. Shared Preferences store small key-value pairs such as settings, and are read with getSharedPreferences() and written through a SharedPreferences.Editor with commit() or apply().
  2. Internal storage keeps private files in the app's own directory using openFileOutput() and openFileInput(), and they are deleted when the app is uninstalled.
  3. External storage (SD card or shared storage) holds files that other apps and the user can read, and it needs the WRITE_EXTERNAL_STORAGE permission in the manifest on older versions.
  4. SQLite holds structured data in tables, and the choice among the four depends on data size and privacy.

Managing data using SQLite

<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>

Definition. <mark>SQLite is a lightweight, open-source, serverless relational database embedded in Android, and each app gets its own private database file.</mark>

Key points.

  1. The SQLiteOpenHelper class creates and upgrades the database through its onCreate() and onUpgrade() methods.
  2. getWritableDatabase() and getReadableDatabase() return a SQLiteDatabase object on which SQL operations are run.
  3. insert(), update(), delete() and execSQL() change data, while query() and rawQuery() read it and return a Cursor.
  4. A Cursor is moved with moveToFirst() and moveToNext(), and its values are read with getString() and getInt(); it must be closed after use.

Sharing Data between Applications with Content Providers

<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>

Definition. <mark>A content provider is an Android component that manages a shared set of app data and exposes it to other applications through a URI.</mark>

Key points.

  1. A provider extends ContentProvider and implements query(), insert(), update(), delete(), getType() and onCreate().
  2. Other apps reach it through a ContentResolver, obtained with getContentResolver().
  3. Data is addressed by a URI of the form content://authority/path/id, for example content://contacts/people/5.
  4. The provider must be declared in the manifest with <provider> and can protect its data with permissions; built-in providers include Contacts, MediaStore and Calendar.

Using Android Networking APIs

<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>

Definition. <mark>Networking APIs let an app send and receive data over the internet, using classes such as HttpURLConnection, or libraries such as Volley and Retrofit.</mark>

Key points.

  1. The app needs the INTERNET permission in the manifest, and ACCESS_NETWORK_STATE to check connectivity through ConnectivityManager.
  2. Network calls must never run on the main UI thread, otherwise NetworkOnMainThreadException is thrown, so AsyncTask, threads or a library are used.
  3. HttpURLConnection opens a connection to a URL, and the response is read from its InputStream.
  4. Retrofit and Volley simplify requests, and JSON responses are parsed with JSONObject or Gson.

Using Android Web APIs

<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>

Definition. <mark>Web APIs let an app consume web services, usually REST over HTTP, and show web content inside the app with the WebView widget.</mark>

Key points.

  1. A REST API uses HTTP methods GET, POST, PUT and DELETE on URLs, and returns data usually in JSON or XML.
  2. WebView displays a web page inside an activity using loadUrl("http://..."), and needs the INTERNET permission.
  3. getSettings().setJavaScriptEnabled(true) turns on JavaScript, and a WebViewClient keeps links opening inside the app rather than in the browser.
  4. Responses from a web API are parsed, then shown in the UI on the main thread.

Using Android Telephony APIs

<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>

Definition. <mark>Telephony APIs give an app access to phone features such as calls, SMS and device and network information.</mark>

Key points.

  1. TelephonyManager gives phone state, network operator, device ID and SIM details, and needs the READ_PHONE_STATE permission.
  2. SmsManager.getDefault().sendTextMessage() sends an SMS and needs SEND_SMS; incoming SMS is received by a BroadcastReceiver with RECEIVE_SMS.
  3. A call is made with an Intent of action ACTION_CALL and a tel: URI, needing CALL_PHONE, while ACTION_DIAL only opens the dialer and needs no permission.
  4. A PhoneStateListener reports call-state changes such as ringing, offhook and idle.

Deploying Android Application to the World

<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>

Definition. <mark>Deployment is the process of preparing, signing and publishing a finished app so that users can download it, mostly through Google Play.</mark>

Key points.

  1. The app is first tested, given a version code and version name in the manifest, and built in release mode with debugging turned off.
  2. The APK (or app bundle) must be digitally signed with a private key stored in a keystore, and the same key is needed for every update.
  3. A Google Play developer account is created with a one-time registration fee, then the APK, icon, screenshots and description are uploaded.
  4. The app can also be distributed by email, a website or other stores, and the Play Store gives updates and statistics.

Last-minute revision

  • Android storage options are Shared Preferences, internal storage, external storage and SQLite.
  • Shared Preferences hold key-value pairs and are written with an Editor and commit() or apply().
  • SQLite is serverless and private to the app, managed through SQLiteOpenHelper.
  • A query returns a Cursor, which is moved with moveToNext().
  • A content provider shares data through content://authority/path/id and is accessed by a ContentResolver.
  • Its main methods are query, insert, update, delete and getType.
  • Networking needs the INTERNET permission and must run off the UI thread.
  • WebView uses loadUrl(), and JavaScript is enabled through its settings.
  • TelephonyManager needs READ_PHONE_STATE; SmsManager needs SEND_SMS.
  • ACTION_CALL places a call directly; ACTION_DIAL opens the dialer.
  • A release APK must be signed with a keystore key before publishing on Google Play.

Memory hooks

  • Storage four: "PIES", meaning Preferences, Internal, External, SQLite.
  • CRUD in a provider: Query, Insert, Update, Delete, plus getType.
  • URI shape: content, authority, path, id.
  • Network: permission first, thread second.
  • Deploy: Test, Version, Sign, Upload.

Coverage checklist

  • Using Android Data and Storage APIs: no past questions; covered by definition and key points.
  • Managing data using SQLite: no past questions; covered by definition and key points.
  • Sharing Data between Applications with Content Providers: no past questions; covered by definition and key points.
  • Using Android Networking APIs: no past questions; covered by definition and key points.
  • Using Android Web APIs: no past questions; covered by definition and key points.
  • Using Android Telephony APIs: no past questions; covered by definition and key points.
  • Deploying Android Application to the World: no past questions; covered by definition and key points.
Go to where you left off?

Quick Add to Notes

Save questions, your own notes and screenshots into notes filed by unit. It takes a free account.

Create free account

Have an account? Log in