2. StorageOptionsForData:
Androidprovidesseveral optionsfor youto savepersistent applicationdata.
Thesolutionyouchoosedependsonyourspecific needs, suchaswhether
thedatashouldbeprivatetoyourapplicationor accessible toother
applications(andtheuser) andhowmuchspaceyourdatarequires.
Thedatastorageoptionsarethefollowing:
• SharedPreferences
• Internal Storage
• External Storage
• SQLiteDatabases
• NetworkConnection
SharedPreferences:
o Storeprivateprimitivedatain key-valuepairs.
o TheSharedPreferences classprovidesageneral frameworkthat
allowsonetosaveandretrievepersistent key-valuepairsof primitive
datatypes.
o OnecanuseSharedPreferences to saveanyprimitivedata:
booleans, floats, ints, longs, andstrings.
o Thisdatawill persist acrossusersessions(evenif yourapplicationis
killed)
Internal Storage:
o Storeprivatedataonthedevicememory.
o Onecansavefilesdirectly onthedevice's internal storage.
o Bydefault, filessavedto theinternal storageareprivateto your
applicationandotherapplicationscannot accessthem(nor canthe
user).
o Whentheuseruninstalls your application, thesefiles areremoved.
3. External Storage:
o Storepublic dataonthesharedexternal storage.
o EveryAndroid-compatible devicesupports ashared"external
storage" that youcanuseto savefiles. Thiscanbearemovable
storagemedia(suchasanSDcard) oraninternal (non-removable)
storage.
o Filessavedto theexternal storageareworld-readableandcanbe
modifiedbytheuser whentheyenableUSBmassstoragetotransfer
filesonacomputer.
SQLiteDatabases:
o Storestructureddatain aprivatedatabase.
o Androidprovidesfull support for SQLite databases. Anydatabases
youcreatewill beaccessiblebynameto anyclassin theapplication,
but notoutsidetheapplication.
o Therecommendedmethodto createanewSQLitedatabaseis to
createasubclassof SQLiteOpenHelper andoverride
theonCreate() method,in whichyoucanexecuteaSQLitecommandto
createtablesin thedatabase. Youcanthenget aninstanceof your
implementationusingtheconstructor you'vedefined.
o YoucanexecuteSQLitequeriesusingthequery() methods, which
accept variousqueryparameters, suchasthetabletoquery, theprojection,
selection, columns, grouping, andothers.
o Forcomplexqueries, suchasthosethat requirecolumnaliases, you
shoulduseSQLiteQueryBuilder, whichprovidesseveral convienent
methodsfor buildingqueries.
o EverySQLitequery will returnaCursorthat points toall therows
foundbythequery. TheCursor is alwaysthemechanismwithwhichyou
cannavigateresults fromadatabasequery andreadrowsandcolumns.
4. Parameter Comment
StringdbName Thetablenameto compilethequeryagains
String[] columnNames Alist of whichtablecolumnsto return.
Passing"null" will returnall columns.
StringwhereClause Where-clause, i.e. filter for theselection
ofdata, null will select all data.
String[] selectionArgs Youmayinclude?sin the"whereClause"".
Theseplaceholderswill get replaced
bythevaluesfromtheselectionArgsarray.
String[] groupBy Afilter declaringhowtogrouprows,
null will causetherowsto notbegrouped.
String[] having Filter for thegroups, null meansnofilter.
String[] orderBy Tablecolumnswhichwill beusedto
order thedata, null meansnoordering.
o Thequerymethodtakes5parameterswhicharedescribedbelow:
NetworkConnection:
o Youcanusethenetwork(whenit's available) to storeandretrieve
dataonyour ownweb-basedservices. Todonetworkoperations, use
classesin thefollowingpackages:
java.net.*
android.net.*
Androidprovidesawayfor youto exposeevenyourprivatedatatoother
applications—withcontentprovider. Acontent provider is anoptional
component that exposesread/write accessto yourapplicationdata, subject to
whateverrestrictionsyouwanttoimpose.
5.
6. MOBILECLOUDCOMPUTING(MCC):
Whatis MCC?
MCCat its simplest referstoaninfrastructurewhereboththedatastorage
andthedataprocessinghappenoutsideof themobile device. Mobile cloud
applicationsmovethecomputingpoweranddatastorageawayfrommobile
phonesandintothecloud, bringingapplicationsandmobile computingto notjust
smartphoneusersbut alsoamuchbroaderrangeof mobile subscribers.
MCCintegratescloudcomputinginto themobileenvironmentand
overcomesobstaclesrelatedto theperformance(e.g., battery life, storage, and
bandwidth), environment(e.g., heterogeneity, scalability, andavailability), and
security (e.g., reliability andprivacy)discussedin mobile computing. In termsof
services, MCCextendsprocessingandstoragebeyonddevicesandseamlessly
integrateswithother servicesandsensordatatoopenupnewclassesof
applicationsknownascontext-awareapplications.
DifferencebetweenMobileComputingandCloudComputing:
1) First, thereis anoverlapbetweenthetwocomputingparadigms.Cloud
computingaimsto provideservicesto userswithout lettingthemknowwhere
theseservicesarehostedorhowtheyaredelivered. Mobile computingaimsto
support mobility sothat userscanaccessresourceswithwirelesstechnology.
2) Second,it is possibleto build cloudswithinmobile devicesfor datastorage
andprocessing. Althoughmobile devicesnowadaysareweakin termsofenergy,
power, storage, andcommunication, this situationwill beimproveddramatically
with thedevelopmentof technology.Hyraxshowsthat aplatformderivedfrom
Hadoopcansupport cloudcomputingonAndroidsmartphones. It demonstrates
thepossibility that acloudcomposedof mobiledevicescanprovidebasic
functionsandservicesofcloudcomputing.
3) Lastly, cloudcomputingservicesaredevelopedmainly for enterprises
whereasmobile computingservicesaredevelopedmainly for individuals.
Whydoweneedmobilecloudcomputing?
7. 1) Mobile cloudcomputingexploits informationaboutauser’s location,
context, andrequestedservicesandsignificantly evolvesthe
heterogeneousaccessmanagementschemesfor traditional
heterogeneousaccessscenarios. Thisis called“intelligent access”. It
cannoticeably improveuser experience.
2) Capacity ofmobile deviceshasincreaseddramatically withthe
growthofmobile users, especially withtheprevalenceof smartphone
users. Eachmobiledevicehasstorage, computing, sensing, and
powerresources. Byusingtheseresources, applicationsorservices
canbeeasily accessedbyusersinsideandoutsidethemobile
network.
3) Therearestill someobstaclesto implementingcloudcomputing, and
mobile computingtechnologycanhelpovercometheseobstacles.
LongWANlatenciesareafundamental obstacle whenamobile
deviceexecutesaresource-intensiveapplicationonadistant high-
performanceserver or cluster. Asolutionis to instantiatecustomized
servicesoftwareonanearbycloudlet andthento usethat service
overawirelessLAN.
MCCArchitecture:
8. • In theabovefigure, mobile devicesareconnectedto themobile
networksviabasestations(e.g., basetransceiver station(BTS), access
point, orsatellite) that establishandcontrol theconnections(air links) and
functional interfacesbetweenthenetworksandmobile devices.
• Mobile users’ requestsandinformation(e.g., IDandlocation) are
transmittedto thecentral processors that areconnectedtoservers
providingmobile networkservices.
• Here, mobile networkoperatorscanprovideservicestomobile users
asAAA(for authentication, authorization, andaccounting) basedonthe
homeagent (HA)andsubscribers’ datastoredin databases.
• After that, thesubscribers’ requestsaredeliveredtoacloudthrough
theInternet.
• In thecloud, cloudcontrollers processtherequeststo providemobile
userswiththecorrespondingcloudservices. Theseservicesaredeveloped
with theconceptsof utility computing, virtualization, andservice-oriented
architecture
AdvantagesofMCC:
9. • Extendingbatterylifetime: bymovingtheexecutionofcomputation
intensiveapplication‘to thecloud’.
• Improvingdatastoragecapacityandprocessingpower:MCCis
developedtoenablemobile usersto store/accessthelargedataonthe
cloudthroughwirelessnetworks.
• Improvingreliability: Storingdataorrunningapplicationsonclouds
is aneffectivewayto improvethereliability sincethedataandapplication
arestoredandbackeduponanumberof computers. This reducesthe
chanceof dataandapplicationlost onthemobile devices.
• MCCalsoinherits someadvantagesof cloudsfor mobile services
suchas dynamicprovisioning, scalibility, multi-tenancyandeasyof
integration.
• Mobile cloudsmight provideanumberofnewtechnical
functionalities. In particular, provisioningof context- andlocation-awareness
enablespersonalizationof servicesis anattractivefunctionality.
IssuesofMCC:
1. IssuesinMobileCommunicationSide:
a) LowBandwidth: Bandwidthis oneofthebigissuesin MCC
sincetheradioresourcefor wirelessnetworksis muchscarce
ascomparedwiththetraditional wirednetworks.
b) Availability: Serviceavailability becomesmoreimportant
issuein MCCthanthat in thecloud
computingwithwirednetworks. Mobileusersmaynotbeable
to connect tothecloudtoobtainservicedueto traffic
congestion, networkfailures, andtheout-of-signal.
c) Heterogeneity: MCCwill beusedin thehighly heterogeneous
networksin termsof wirelessnetworkinterfaces. Different
mobile nodesaccessto thecloudthroughdifferent radio
accesstechnologiessuch. Asaresult, anissueofhowto
handlethewirelessconnectivity while satisfyingMCC’s
requirementsarises.
10. 2. IssuesinComputingSide:
a) EnhancingtheEfficiencyofDataAccess:Withan
increasingnumberof cloudservices, thedemandof accessing
dataresources(e.g., image, files, anddocuments) onthe
cloudincreases. Asaresult, amethodto deal with(i.e., store,
manage, andaccess) dataresourcesoncloudsbecomesa
significant challenge. However, handlingthedataresourceson
cloudsis not aneasyproblemduetothelowbandwidth,
mobility, andthelimitationof resourcecapacity of mobile
devices.
b) Security: Protectinguserprivacyanddata/applicationsecrecy
fromadversary is akeyto establishandmaintain consumers’
trust in themobile platform,especially in MCC.Tocombat the
security threats, current mobiledevicesrunthethreat detection
servicesonthemobile deviceitself. Suchanexercisewarrants
intensiveusageofresourcesbothin termsofcomputationand
power. Apossiblesolutionis to comewithanewmodel of
security wheredetectionservicescanbemovedto cloud. It
significantly savesthedeviceCPUandmemoryrequirements
but at thecost of increasingbandwidth. Suchanapproachhas
several benefits:
-- Better detectionofmalicioussoftware.
-- Reduceon-deviceResourcesconsumption.
-- Reduceon-deviceSoftwarecomplexity.
3. AbsenceofStandards:
Althoughthey’reanumberof advantagesof MCC,thereis noopen
acceptedstandardavailablefor Cloudcomputing. Followingarethe
problemsexistingdueto lackof openstandards:
a) Limitedscalability.
b) Unreliableavailability of aservice, in caseofabreakdown.
11. c) Serviceprovider lock-in, duetoabsenceof portability
betweenvariousproviders.
d) Unableto deployserviceovermultiple CCSPs,sincethere
is nointeroperability betweenthem.
CONTEXT-AWARECOMPUTING:
12. Context-awarecomputingis amobile computingparadigmin which
applicationscandiscoverandtakeadvantageofcontextual informationsuchas
userlocation, timeof day,neighboringusersanddevices, anduseractivity.
Whatis context-awarecomputing?
It is definedassoftwarethat examinesandreacts to anindividual’s changing
context. In other words, theapplicationis awareof its user’s stateand
surroundings, andhelpsto adaptits behavior.
Basicfunctionsofanycontext-awareapplication:
1. Presentationofinformationandservices: refers tofunctionsthat
either present context informationto theuser, orusecontext topropose
appropriateselectionsof actionstotheuser. Anexamplecanbeshowinga
usertheir locationonamapandpossibly indicatingnearbysitesof interest
orpresentingachoiceof servicescloseby.
2. Automaticexecutionofservices: describesfunctionsthat trigger a
commandorreconfigurethesystemonbehalf of theuser accordingto
context changes. Anexamplecanbeacar navigationsystemthat
recomputesdrivingdirectionswhentheusermissesaturn.
3. Storageandretrievalofcontext information: applicationstag
captureddatawithrelevant context information. Forexample, azoology
applicationmaytagnotestakenbytheuser withthelocationandtimeof a
speciesobservation.
Frameworkofcontext-awaresystems:
Fromthefunctional viewpoint, context-awaresystemscanberepresentedas
alayeredframework. Thisframeworkconsistsof 5layers:
13. 1. Thefirst layer (sensors) is acollectionof sensorsresponsible for raw
datafromtheuser environment. (e.g. user device, social network, or
useraccessnetwork)
2. Thesecondlayer(rawdataretrieval) makesuseofspecific
applicationprogramminginterfacesorprotocolsto request datafrom
thesensorlayer. Thesequeriesmustasfar aspossible be
implementedin ageneric way,makingit possible toreplacesensors.
3. Thethird layer(preprocessing) is responsiblefor reasoningand
interpretingcontextual information. It transformstheinformation
returnedbytheunderlyinglayer toahigher abstractionlevel (e.g. it
transformsaGPSpositiontoonesuchasat homeorat work). Not
onlysensedordeduceddatahaveto bemodeled, but alsodata
describingthem(e.g. accuracyandrecall, or lifecycleinformation).
4. Thefourth layer(storageandmanagement) organizesthegathered
dataandmakesthemavailable tothirdparties’ applicationsin a
synchronousor asynchronousway.In thefirst modethethird-party
applicationsuseremotemethodcalls topoll theserver for changes.
In thesecondmodetheysubscribeto specific eventsofinterest and
14. arenotifiedwhentheeventoccurs(e.g. byacall back).
5. Thefifth layer (application) is wherethereactionsto context changes
areimplemented(e.g. displayingtext in ahighercolour contrast if
illuminationis bad).
INTERNETOFTHINGS(IoT):
Whatis IoT?
TheInternet of Things, alsocalledTheInternet of Objects, refers toa
wirelessnetworkbetweenobjects; usually thenetworkwill bewirelessand
self-configuring, suchashouseholdappliances.
15. CharacteristicsofIoT:
1. Ambient Intelligence
2. Event Driven
3. ComplexAccessTechnologies:
4. Semantic Sharing
5. Flexible Structure
WhyIoT?
1. Dynamiccontrol of industry anddaily life.
2. Improvetheresourceutilizationratio.
3. Better relationshipbetweenhumanandnature.
4. Forminganintellectual entity byintegratinghumansociety and
physical systems.
5. Universal transport andinternetworking
EnablingTechnologiesofIoT:
1. RFID- Toidentify andtrackthedataof things.
2. Sensor - Tocollect andprocessthedatato detect thechangesin the
physical statusofthings.
3. Smart Technologies- Toenhancethepowerof thenetworkby
devolvingprocessingcapabilitiestodifferent part ofthenetwork.
4. NanoTechnologies- Tomakethesmaller andsmaller thingshavethe
ability to connect andinteract.
IoTapplicationsareapart ofvariousdomainslikefood, education,
management, retail, logistics.