0% found this document useful (0 votes)
50 views4 pages

Mobile Computing Data Storage Guide

2
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views4 pages

Mobile Computing Data Storage Guide

2
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1 CTH EDUCATION

Unit – 05: Mobile Computing


 Storing the data persistently –
 Data Storage Options: preferences, Internal Storage, External Storage, Content Provider.
 The SQLite database,
 Database operations -Insert, Delete, Update, Fetch.
 Publishing android applications,
 Deploying APK files.

Questions to be discussed:
1. What do you mean by data persistent?
2. Explain different data storage options in an android.
3. What is SQLite database? Discuss its advantage & disadvantage.
4. Discuss various operations performed on SQLite database
5. What is APK? How to develop APK files?

Diploma : CSE (All Paper) By : Alok Sir (Mob. No.: +91-80 84 370 470)
2 CTH EDUCATION
Storing the data persistently:
 Persistent storage is any data storage device that retains data after power to that device is shut off.
 It is also sometimes referred to as non-volatile storage.
 Android provides several options for you to save persistent application data.
 Your data storage options are the following:
1. Shared Preferences
2. Internal Storage
3. External Storage
4. Content provider
5. SQLite Databases

Shared Preferences:
 Store private primitive data in key-value pairs.
 The Shared Preferences class provides a general framework that allows you to save and retrieve
persistent key-value pairs of primitive data types.
 You can use Shared Preferences to save any primitive data: boolean, floats, int, long, and string.

Internal Storage:
 Store private data on the device memory.
 You can save files directly on the device's internal storage.
 By default, files saved to the internal storage are private to your application
and other applications cannot access them (nor can the user).
 When the user uninstalls your application, these files are removed.

External Storage:
 Store public data on the shared external storage.
 External storage is used to store application data, such as SD card.
 In general there are two types of External Storage:
1. Primary External Storage
2. Secondary External Storage

Primary External Storage:


 It is in-built shared storage which is “accessible by the user by plugging in a USB cable.
 Example: When we say 4GB, 32 GB.

Secondary External Storage:


 It is type of storage which is removed from the android if required.
 It is also known as removable storage. Example: SD Card

Diploma : CSE (All Paper) By : Alok Sir (Mob. No.: +91-80 84 370 470)
3 CTH EDUCATION
Content provider:
 A content provider component supplies data from one application to others on request.
 Such requests are handled by the methods of the Content Resolver class.
 A content provider can use different ways to store its data and the data can be stored in a database, in
files, or even over a network.
 Sometimes it is required to share data across applications then content providers become very useful.

What is database?
 It is an organized collection of structured information or data that stored electronically in computer.
 A database is usually controlled and managed by database management system (DBMS).
 Most commonly used database is SQL.
 SQLite database is used in android.

Android SQLite Database:


 SQLite is an open source relational database.
 It is lighter version of SQL.
 Android comes with built-in SQLite database implementation.
 To access this database, you do not need to establish any kind of connections like JDBC, ODBC etc.
 Main components of SQLite is:
 Table structure (Rows and columns).
 Types of data (int, float, char, double, Boolean etc).
 Constraints (Primary and secondary key).
 Queries (Select, Insert, Update and Delete).

Diploma : CSE (All Paper) By : Alok Sir (Mob. No.: +91-80 84 370 470)
4 CTH EDUCATION
SQLite Advantages SQLite Disadvantages
 Lightweight  SQLite is used to handle low to medium traffic HTTP requests.
 Better Performance  Database size is restricted to 2GB in most cases.
 No Installation Needed
 Portable

Insert, Read, Delete & Update operation in SQLite:


 Android provides different ways to store data locally so using SQLite is one of the way to store data.
 For managing all the operations related to the database, an helper class has been given and is called
SQLiteOpenHelper.
 It automatically manages the creation and update of the database.
 Android OS has its own implementation to perform CRUD operations.
1. Create
2. Read
3. Update
4. Delete

What is APK?
 APK stand for Android Application Package.
 It is a package file format used by android OS for distribution and installation of mobile app.
 It is similar to executable file .exe in windows operating system.
 The extension of APK file is .apk.
 It is installed on android operating system.

Publishing Android Application:


 Android application publishing is a process that makes your Android applications available to users.
 Infect, publishing is the last phase of the Android application development process.
 Once you developed and fully tested your Android Application, you can start selling or distributing free
using Google Play Store.
 You can also release your applications by sending them directly to users or by letting users download
them from your own website.

Diploma : CSE (All Paper) By : Alok Sir (Mob. No.: +91-80 84 370 470)

Common questions

Powered by AI

Content Providers in Android facilitate data sharing between different applications by acting as a managed interface. They utilize the Content Resolver class for data requests, breaking down data isolation typically found in apps. This mechanism benefits developers by allowing integration and data exchange, which is essential in apps requiring collaboration or collective data processing, thus improving app functionality and user engagement .

The Android application publishing process is the final step in Android development, involving making applications available to users. Developers can distribute their applications by selling or offering them for free through the Google Play Store. Alternatively, they can release applications directly to users or allow downloads from their website, after ensuring the application is fully developed and tested .

An SQLite database in Android is structured like a typical SQL database, with tables that include rows and columns, supporting various data types such as int, float, char, double, and boolean. It also implements constraints like primary and secondary keys. The main queries used in SQLite—Select, Insert, Update, and Delete—are consistent with SQL database practices, making SQLite familiar to those experienced with standard SQL databases .

Persistent storage is crucial in mobile computing as it allows data to be retained even after the device is powered off, ensuring data longevity and reliability. Non-volatile storage options, like internal and external storage, enable users to access data across sessions without data loss, enhancing application functionality. The implication of using such storage is that it provides stability and continuity for applications, critical for user experience and overall data management .

In Android, SQLite operations include Create, Read, Update, and Delete (CRUD). These operations are managed through an SQLiteOpenHelper, a helper class that automates database creation and updating. It abstracts the handling of SQLite database and simplifies the process of performing these operations. The Android OS provides implementation support for executing CRUD operations efficiently .

Primary external storage in Android refers to built-in shared storage accessible via USB, like internal flash memory, whereas secondary external storage refers to removable storage such as SD cards. When choosing between them, considerations include the need for portability, data accessibility, and storage capacity. Primary storage typically offers less flexibility but greater integration, while secondary storage provides expanded capacity and ease of data transfer across devices .

APK files, short for Android Application Package, are the file format used by Android to distribute and install apps. They are similar to executable files (.exe) in Windows as both serve as packages for application installation and execution. The APK format allows installation on the Android operating system, facilitating application deployment and management .

SQLite is an open-source relational database integrated into Android for handling local data storage. Its main advantages include being lightweight, providing better performance, requiring no installation, and being portable. Unlike other database systems, it does not require connections like JDBC or ODBC. However, its disadvantages include handling only low to medium traffic HTTP requests and database size restrictions typically limited to 2GB .

Developers managing SQLite databases on Android may face challenges such as handling database size limitations (2GB) and managing concurrent access, which could lead to data inconsistency. These challenges can affect app performance by causing slow queries or crashes under heavy loads. Effective database management and optimization strategies, such as indexing and efficient query structures, are crucial to maintain app responsiveness and reliability .

Android provides several options for persistent data storage, each with different characteristics in terms of privacy and accessibility. Shared Preferences store private primitive data in key-value pairs and are private to the application. Internal Storage saves files directly on the device's memory, which are also private, and removed upon app uninstall. External Storage allows access to public data on shared external storage, such as an SD card, with both primary (built-in) and secondary (removable) types, but is accessible by users and other applications. Content Providers allow sharing of data between applications, controlled via the Content Resolver class, and can store data in files, databases, or over a network .

You might also like