Mobile Software Development ISCG 7424 Department of Computing UNITEC John Casey and Richard Rabeder SQLite and Permissions.

Slides:



Advertisements
Similar presentations
Programming with Android: Data management
Advertisements

Bruce Scharlau, University of Aberdeen, 2012 Data storage options for mobiles Mobile Computing.
SQLite is a software library. It is: self-contained + Serverless + zero-configuration transactional = SQL database engine. Most widely deployed. The source.
30-Jun-15 SQL A Brief Introduction. SQL SQL is Structured Query Language Some people pronounce SQL as “sequel” Other people insist that only “ess-cue-ell”
CONTENT PROVIDER. Content Provider  A content provider makes a specific set of the application's data available to other applications => Share data to.
Cosc 5/4730 Android and Blackberry SQLite. For the sql language syntax, please see SQlite documentation –
SQLLite and Java CS-328 Dick Steflik. SQLLite Embedded RDBMS ACID Compliant Size – about 257 Kbytes Not a client/server architecture –Accessed via function.
SQLite 1 CS440. What is SQLite?  Open Source Database embedded in Android  SQL syntax  Requires small memory at runtime (250 Kbytes)  Lightweight.
CS378 - Mobile Computing Persistence - SQLite. Databases RDBMS – relational data base management system Relational databases introduced by E. F. Codd.
Data Persistence in Android
SQLite Database. SQLite Public domain database – Advantages Small (about 150 KB) – Used on devices with limited resources Each database contained within.
MySql In Action Step by step method to create your own database.
Advance Computer Programming Java Database Connectivity (JDBC) – In order to connect a Java application to a database, you need to use a JDBC driver. –
1 IT420: Database Management and Organization SQL: Structured Query Language 25 January 2006 Adina Crăiniceanu
Database Rung-Hung Gau Department of Computer Science and Engineering
Session 5: Working with MySQL iNET Academy Open Source Web Development.
ANDROID CONTENT PROVIDERS Peter Liu School of ICT, Seneca College.
RDB/1 An introduction to RDBMS Objectives –To learn about the history and future direction of the SQL standard –To get an overall appreciation of a modern.
Data Storage: Part 4 (Content Providers). Content Providers Content providers allow the sharing of data between applications. Inter-process communication.
CS 3630 Database Design and Implementation. Your Oracle Account UserName is the same as your UWP username Followed Not case sensitive Initial.
HSCI 709 SQL Data Definition Language. SQL Standard SQL-92 was developed by the INCITS Technical Committee H2 on Databases. SQL-92 was designed to be.
SQLite Android Club SQLite About onCreate Insert Select Update Delete onUpdate.
SQL SQL Server : Overview SQL : Overview Types of SQL Database : Creation Tables : Creation & Manipulation Data : Creation & Manipulation Data : Retrieving.
Android Storage. There are several options for storage of data with Android We can put data into a preferences file. We can put data into a ‘normal’ file.
9 Persistence - SQLite CSNB544 Mobile Application Development Thanks to Utexas Austin.
Hibernate 3.0. What is Hibernate Hibernate is a free, open source Java package that makes it easy to work with relational databases. Hibernate makes it.
SQL Fundamentals  SQL: Structured Query Language is a simple and powerful language used to create, access, and manipulate data and structure in the database.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
Persistance Android. Adding Persistance SQL Refresher Understand how to create and migrate SQLLite database with android APIs. – Get all tasks – Add a.
What’s a database? Data stored in a structured format that lends itself to easy manipulation and recall.
SQL Jan 20,2014. DBMS Stores data as records, tables etc. Accepts data and stores that data for later use Uses query languages for searching, sorting,
SQLite DB Storing Data in Android RAVI GAURAV PANDEY 1.
Android - SQLite Database 12/10/2015. Introduction SQLite is a opensource SQL database that stores data to a text file on a device. Android comes in with.
SQlite. SQLite is a opensource SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation.
1. Playing with SQLite Database  SQLite : Database specific name for Android Application  For windows there are several kind of database name : Mysql,
Distribution of Marks For Second Semester Internal Sessional Evaluation External Evaluation Assignment /Project QuizzesClass Attendance Mid-Term Test Total.
Starting with Oracle SQL Plus. Today in the lab… Connect to SQL Plus – your schema. Set up two tables. Find the tables in the catalog. Insert four rows.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
CS320 Web and Internet Programming SQL and MySQL Chengyu Sun California State University, Los Angeles.
CHAPTER 9 File Storage Shared Preferences SQLite.
SQL Basics Review Reviewing what we’ve learned so far…….
By: Eliav Menachi.  On Android, all application data (including files) are private to that application  Android provides a standard way for an application.
CMPE419 Mobile Application Development Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren
1 Section 1 - Introduction to SQL u SQL is an abbreviation for Structured Query Language. u It is generally pronounced “Sequel” u SQL is a unified language.
CS499 – Mobile Application Development
Making content providers
Data Storage: Part 3 (SQLite)
Android Content Providers & SQLite
Mobile Applications (Android Programming)
SQLite in Android Landon Cox March 2, 2017.
CS320 Web and Internet Programming SQL and MySQL
Mobile Applications (Android Programming)
Android Application SQLite 1.
Reactive Android Development
Android Database using SQLite
Mobile Application Development Chapter 5 [Persistent Data in Android]
Android Storage.
CMPE419 Mobile Application Development
مقدمة في قواعد البيانات
CMPE419 Mobile Application Development
Mobile Computing With Android ACST 4550 Android Database Storage
CS3220 Web and Internet Programming SQL and MySQL
Android Developer Fundamentals V2
Databases Continued 10/18/05.
ListView A view that shows items in a vertically scrolling list. The items come from the ListAdapter associated with this view. ListAdapter is used to.
CS3220 Web and Internet Programming SQL and MySQL
Department of School of Computing and Engineering
SQLLite and Android.
Mobile Programming Dr. Mohsin Ali Memon.
Presentation transcript:

Mobile Software Development ISCG 7424 Department of Computing UNITEC John Casey and Richard Rabeder SQLite and Permissions

Content 2 SQLite Helper classes Gotchas Permissions Readings

SQLite 3 Small,fast,compact, embedded SQL database Not a full featured SQL dialect Every Android phone has a copy of SQLite No database administration Need to write Java code to create and alter table structures

SQLite 4 One file per database Locally available persistent data store – can access information when not connected to the internet / network DDL and DML Can perform CRUD (create, read, update, delete) Insert Select Update Delete Using RAW SQL interface or SQLite helper methods

SQLite Application Structure 5 Extend SQLiteOpenHelper and override OnCreate() OnUpgrade() Define database fields, table name and database version Declare helper subclass in Activity object Open Readable or Writable database as needed

Declare Constants 6 public final static int VERSION = 1; public final static String NAME = "mobile.db"; public final static String TABLE = "CLIENT"; public final static String CID ="CID"; public final static String FIRSTNAME="FIRSTNAME"; public final static String LASTNAME="LASTNAME"; public final static String NOTES="NOTES";

7 public class W5DBHelper extends SQLiteOpenHelper { public final static int VERSION = 1; //... this is where the constants from previous page would go public W5DBHelper(Context context) { super(context, NAME, null, VERSION); public void onCreate(SQLiteDatabase db) { String sql = "create table " +TABLE +" ("+CID+" integer primary key, "+FIRSTNAME+" text, "+LASTNAME+" text, "+NOTES+" text);"; db.execSQL(sql); public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("drop table if exists "+TABLE); onCreate(db); } Define Helper

Using the Helper class 8 W5DBHelper helper = new W5DBHelper(getApplicationContext()); dbHandler = helper.getWritableDatabase(); String sqlInsert = "insert into CLIENT (CID,FIRSTNAME, LASTNAME, NOTES) values(null,'John','Casey','blah blah blah');"; dbHandler.execSQL(sqlInsert);

SQLite Helper Methods 9 ContentValues values = new ContentValues(); values.putNull(W5DBHelper.CID); values.put(W5DBHelper.FIRSTNAME,"John"); values.put(W5DBHelper.LASTNAME,"Casey"); values.put(W5DBHelper.NOTES,"Blah blah”); dbHandler.insert(W5DBHelper.TABLE,null, values);

Things to remember SQLite isn’t Oracle or MS SQL Server Has its own very unique syntax Android’s SQLite appears to be slightly different to plain old SQLite Does not completely implement all the SQL features you would normally expect: data types, stored procs, even some types of join query

Permissions 11 Per resource model: Grant / Revoke Location Phone calls Blue tooth Network access Wi-fi Internet Personal information Spend money on the market Its easy!

Permissions 12 Declare resources that the application needs in the manifest file – before the application XML block Application will then prompt user to grant that resource to the application

Readings 13 ml ml /sqlite/package-summary.html /sqlite/package-summary.html sqlite/ sqlite/ example-using-androids-sqlite.html example-using-androids-sqlite.html