Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
32 views
64 pages
Mad Chapter 5 and 6
Uploaded by
patilmanas87
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save mad chapter 5 and 6 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
32 views
64 pages
Mad Chapter 5 and 6
Uploaded by
patilmanas87
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save mad chapter 5 and 6 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 64
Search
Fullscreen
‘Android Intent is the message that is passed between components such as activities, content providers, broadcast ee, tis generally used with startActivity() method to invoke activity, broadcast receivers ete ‘The Labeledintent is the subclass of android.content Intent elas. Android intents are mainty used to perform following tasks: 1. Stan the service 2 Launch an activity 3. Display a web page Display alist of comtacts 5. Broadcast a message 6. Dial a phone call etc ‘The following Fig. 5.1.1 shows how an intent is used to start an activity Intent‘5.1.2. Types of Intent 1. impli pot name a specific component, bot inst sestead declare a general action to perform, which allows 8 component from eter 0 ‘pis xs aod esate, yn oat sre Oe ‘user a Jocation on 3 « map, you can use an implicit intent to request that anther Capable app te 2 Jocaton on a map. ow cx wie following code 1 ew a webpage“widroidayoun_marginop="17240" ee “app:layout_constraint8ind_1oEndOF="paront” % © ppilayout_constraintHorizontal_bins="0.0" ‘app:layout_con parent” app: Pout _conaternfTop_ieBotiom0(="@-+ ident Text" /> : (i) MainActivity java jon.implicitinten [package example.MyApp! import android content Jntent; pe. import android.net.Uris : {import unedroidsupport.v7.app-Apo import android.os. Bundle: import android. view. View {import android. widget-Buttr ‘import android. widget BditText; a patActivitys public class MainActivty extends AppCompatActivity { Button button; FadiText editText;(MSBTE-Sem-6-Comp) package name or a fully qualified, aa p because you kaow the clas me f ae cay, P “which application will satisfy the intent, by supplying either the tar “Yoott typically use an explicit inteat to star component sm your own yoo watt stat Je. you might start a new activity within your app in response (0 2 Wer action, oF Mart a Service Wo downoad a fie in the vityTwo.class); "http: /schemas.android.com/apk/res/andreid™ SACHIN SHAH Yeatare£9 Activity and Muli Ranalte extras = gettatent().getE xtra); String valuel = oxtr ring("Valuel Steing vale? = extras getString("Valie2”); ‘ToastamakeToxt(get Application "a Second Value: "+ valu Tonst.LENGTH_LONG).show(); ) public void callFirstActivity(View view)( Tnteot i = new Kntent(getApplicationContext(), FirstActvity.class); 2 startAetivity(i; 2 5.1.3. Intent_Filter An intent filter is used to specify the ty apabilities ofits parent component, I opens advertised type, while filering out those that are not mes ‘component, Intent filters area ‘Powerful feature of the Android platform. They provide the ability o launch an activity based
tg to contro which apps can stat a patcuar activity. A parent activity e ‘sctivity unless both activities have the same permissions in their manifest. Xt yoo declare a
clement for a parent activity, each child activity must have a matching < clement ‘
‘Sectivity androidsname="...” ‘sodrid:pernission="com google socalapp permission SHARE_POST™ Sara rs % 5.25 Activity Life Cycle What is activity? Explain lifecycle of activity, ‘As a user navigates through, activity ‘destroying the process in whichsTE- 512 and Muttnecia with Databases rom the active state, if we hit the Home key, dhe Activity goes tothe background and the Home Screen f te stvice is made vse. During this event, the Activity enters the stoped ste, Bot onPaue) and onto) method a execute «genet: When an avy is desroye by a ser of And yen, odes fantom cle vc we change te oration ofthe scren i from por to lndsape veer, eecle methods tat frm he sa erect) et Ths seca he complet acing md te vil aperne pt change dad ie & “The activity no longer User navigates to sible ‘he actwty =a t ‘The actvty is fishing ‘or being destroyed by the system Fig, 52:1 : Android Activity Life Cycle Following code wil explain the working activity lifecycle 1. activity_main xmFor example, the Android system sends broadcasts when various system evens occur, such a when the farts charging. Apps can also send custom broadcasts, for example, to aoily ether app of something at en an event of interest OCU rem toos up or the device toy mht be iterested in 33 526 Broadcast Receiver nid Broadcast Receiver iso ofthe impotant components of Android application development. Broadcast sins BSS 8 ‘component of android application. With this component we can reser recive for any system eel = hat event occurs, android system will moify the registered receivers about the execution of event respectively ‘Types of broadcast 1. Normal Broadcasts These ar asynchronous broadcasts, Receivers ofthis type of broadcasts may ran i any order, sometimes altogether, isis efficient. Receivers cannot use the result. ‘They cannot abort the included APIs. ‘These broadcasts are sent with Context sendBroadcast 2 Ordered Broadcasts ‘Ths ar synchronous broadcasts. ‘ne broadcast is delivered Wo one receiver at time. ecxvercan we the result In fact as each receiver executes, resis passed ¥ next receive Receiver can aot the broadcast and ence no broadcast is ecived by other receiver, ‘Th oe of eceivers is managed and contd by the abut andro pnt in ‘eceivers wil have same priority then they may fun in any orde, inevoid onReceive(Contest context, Intent intent) { ae exons “nen Detected Tnx LENCTH_LONO) ow % % 5.2.8 Registering Broadcasts ~The intent clas is used to send and receive the broadcasts bot they are not similar to starting activity with With activites are foreground processes whereas broadcast intents are background processes. sendBrondes responsible for sending broadcast. = If you don’t want broadcasts to be global then you can use another class instead of sendbroadeasi() LocalBroadcastManager. There willbe no inter-process communication and hence no security issue. No ot able 10 know abovt this broadcast except the intended application. We have to register our receiver. Regis done in following two ways © Static : Implementation is published through Manifest ile. thas a
tag which is meant for this © Dynamic: Itis registered dynamically by Context registerReceiver) fa receivers registered in the onResume( callback of our Activity ten it should be unregistered in the onP While you pause the activity, receivers will ake rest and don’t do anything which in turn saves resources. % 5.2.9 Broadcast Receiver Life Cycle ~ Receiver has a limited and defined life cycle. Consider the following points about life cycle of receiver : © BroadcastReceiver object is valid tl the accomplishment of call onReceiver(Context, Intent), © When funtion returns, system wil grant it as an object which has finished its work. Iis not active. © _Inthis case, NotificationManager API should be used. © Incase of asynchronous operation the scenarios diferent. Ther has tobe something which should ‘operation afer it returns In this case, BroadcasRecciver is ile by system before asynchronous © Imthis case, Content statService() should be used to send command to service.‘When device pred cay cette ts start wp vequence hen his boadas i fred. Ts broads only when the application has the RECEIVE, BOOT_COMPLETED “This roaass fied when camer nen date andor time are changed manually then these broadcasts are fied respectively Bless i is bode fi To weve aoe ‘opened were read from or writen to external storage media, aplication should listen to this broadeast. ‘When any external storage media is added and /or removed, these broadcasts ar fired. |acTION_MEDIA_UNMOUNTED ACTION NEW_OUTGOING.CALL | When a new ogoing cals paced this broad i fred "ACTION _SCREEN_ON, ‘When screen turns on and/or turns off, this breadast is fired ‘ACTION_SCREEN_ OFF “ACTION TIMEZONE_CHANGED | Whenever device's cuent ine zoe is changd this ronda is Fired. ys 5.2.11 Broadcast ExampleDae Toast nakeText(arg0, “Hello Readers! broadeaste "+ inData, Toast LENGTH_SHORT show() ) ore. Syllabus Covered 53 Content Provider, Fragments m 5.3 CONTENT PROVIDER ~ _Acontent provider manages accesso a central repository of data, A providers Part of an Android application, which often provides its own Ul for working wi the data, However, content providers are primaily intended 10 be used by other applications, which ‘ccs the provider using a provider client object. Tosser, providers and provide clients offer a consistent, standard interface to data that also hands imter-processcommanicton and secure data access. ‘ content provider resents data to external applications as one or more tables that ae similar othe tables found in relational aabase. A row represents an instance of some typeof dita the provider collects, and each column in the row rpreseats an Individual piece of data collected fo an instance. ‘content provider coordinates acces tothe data storage layer in your aplication fora umber of difereat APs and componcss ws ‘strated in figure below, these inclode: ‘Sharing acess to your application data with other applications © Sending data toa widget ‘Returning custom search suggestions for your application through the search frame werk using ‘Synchronizing application data with your server using an implementation of AbstractThreadeSync AdapterFig. 5. “$1: Relationship between content provider and other ‘components,imple. My Application StudentsProvider'/> ‘android:authorities ="com.exa ‘ % 5.3.1 Fragments Re 6 ea, = S . ogo 180. 53.2 How to create fragment in android? Explain with syntax. 8 A Fragment represents a behavior or pina of ener in a Fragmenctvty. You can combine ‘multiple a avy t build muli-pane UTand ruse afmprcat nsulipe cere Sean est sways be hoited in an sciviy andthe fagmears lifecycle is directly affected by the host activity’ tee 5 ‘TEMeAKS. Hopes Pe aa OU Pets solarall rmgments is ie eed che ta activity is destroyed, so are all Sctiviy is running you can manipulate each fragment independently, such as add or remove them, art of your activity layout, it lives in a Vi ng the layout of an those changes in aback stack ee For example, a news apliat on the right-both ee wandlesplication Development (MSBTE-Sem-6- 53.2 Lifecycle of a Fragment > spent lifecycle contains following phases, mei attach() + The activity is passed here. It is called ven fragment is associated with the activity Create() : This method is called by the system when ven is created. If You Want f0 retain any component the fragment while i is paused oF stopped and meant te resumed later then these components are to be vtialized in this callback. vacreateView() # IC is called for the creation of view cerarchy associated with the fragment. When fragment ws its user interface for the first time, this method is
8 fener doesnt allow components o start it by calling starServce, te a bound service when you want to interact with the service from activities and other components in your applica to other applications through interprocess communication (IPC). vice, implement the onBind() callback method to return an TBinder that defines the interface for communication son the creat f on oF pose some of your application's functional ‘To ereate a bound se service. Other application components can then call bindService() to retrieve the interface and begin calling, methods wth the vrrtice, The service lives only 10 serve the application component that is hound toi, so when there are no components bound 1 Hr eres the system destroys it. You Jo not need to stop a bound service in the same way that you must when the service is started through onStartCommand(), nd service, you must define the interface that specifies how a client can communicate wit een the service and a client must be an implementation of Binder and is what your service must return from the ening) hack method. After the client receives the IBinder, it can begin interacting with the service through that interface, it calls unbindService0 10 To create a bo ith the service. This interface call Multiple clients can bind to the service simultaneously. When a client is done interacting withthe service, ‘no clients bound to the service, the system destroys the service. and the implementation is more complicated than a started service. For these ‘unbind. When there a ‘There are multiple ways to implement a bound service, reasons, the bound service discussion appears ina separate document about Bound Services. Ys 5.4.5 Sending Notifications to the User When a service is running, it can notify the user of events using Toast Notifications or Status Bar Notifications. — toast notification is a message that appears on the surface ofthe curent window for only a moment before disappearing. A status tur notifiation provides an icon inthe status bar with a message, which the user can select in order to take an action (such as start an activity). = Usually, a status bar notification isthe best technique fo use when background work such asa file downioad has completed, and the tser can now act on it. When the user selects the notification from the expanded view. the notification can start an activity (such as 10 display the downloaded file). %3 5.4.6 Running a Service in Foreground a a ee eer dsc aban or nese 10 Kil when low on emery ‘A for gonad service must prove a ntiiaton forthe status ber, which i placed under the Ongoing beading, This means thet the oifcation cannot be dismissed unless the service i either topped or removed from the foreground ea ed be me orn eros. Possess ver expel eae ee etm pec Out sms owl te wes > leech save © ve app to et wer rack their runs would sod a foreground sevice to track the user'sB) Mobile Application Devolopment (MSBTE-Sem-6-Comp) _5-37 ssetContentTitle(getText(R string.notfication_t SetContentText(gerText(R.string, le)) Beaton message) -setGontentlotemt(pendinglntent) ° ~setTicker(getTex(R string. ticker_text)) build); ‘StartForeground(ONGOING_NOTIFICATION_ID, notification); *3 5.4.7 Creating a Background Service ~ _The ImentService clas provides a stsighforward structure for runing an operation on a single background thread This aig Bade long-reming operations without affecting your wer interac’ responsiveness. Also, an Intent Servi isnt affect ler interface lifecycle events, so it contin wes 10 run in circumstances that would shut down an AsyncTask ‘An IntentService has a few limitations Steen mterac iecty with your user inerface. To pts rents nthe UI, you have o‘scad then mn Acivig © Work requests run sequentially. an operation isruming in en InenServic, and You send it another request, the request ‘ats until the frst operation is finished : A® operation running onan IntenService cant be interuped However, in most cases an InlenServic isthe prefered way eriorm simple background operations, 3 5.4.8 Handle Incoming intents To create an IntentService ‘overrides onHandlelntent(). For example ‘component for your app, define a class that extends IntentService, and within it, define a[ye : The ON “xpi ntent, $0 0 fi ‘found service i an implementation ofthe Service clas hat allows ote applications to hind toi and interact with it. To provide ‘wing fr @ service, you must implement the onBind() callback method. This method returns an IBinder abject that defines the ‘ramming interface tha cliemts can use to interact with the service, °s 54.11 Creating a Bound Service Wie crating a service that provides binding, you must provide an Binder tht provides the programming interface tat cients can icrat with the service. There are dhree ways you can define the interface: Extending the Binder class ‘ne pees ae scorns you dl coe sm yee ce GT: ees Bind end aa we nc ‘te bl eens This is the refed 4 background worker for your own application. The only reason you valet agfgoow shia service alee or the client Binder. Because 1” ‘clients, we dont need !2 deal with IPC: * Class used ‘runs in the same process 8 /j Return this instance ‘of LocalService s0 clients £0" ‘ell public method> return LocalService.this: All clients unbind sleiteolee heen3. 5.4.13 Permission ‘must have in onder to launch the service or bind to it If caller of statServiceQ, ~The same of a permission that an entity rane this permission the method will not work andthe Intent object wil not Be tindServicel), or stopService(), has not been livre to the service. = dati not st the permission set bythe
clement permission able apis tothe service, neither snhate is et, the service is not protected by permission 5.5 MULTIMEDIA FRAMEWORKIL Cntegraion Layer) component: ‘an Open media, you must implementa hardware-based codec as an OPS Architecture ‘rameworks/avlibmedia MediaPlayerBinger TIEDIA PLAYER SERVI ‘ramewors/avimedial lipmediaplayerservice (OMX INTEGRATION MediaPlayerService.cPD ‘ iL COMPOr IGHT ENGINE Hardware Codec pipaenn poraeenieee”. frameworks/avimediaflibstagefright [Eeomxrwucn a] MediaSource.cpp Wbstagotighthw 30 OMX Gore 1 : Multimedia Framework (Media Architecture) Application Framework ‘At he application framework levels application code that ilizes android.media APIs to interact with the Binder IPC ‘The Binder IPC proxies facilitate communication over process bour directory and begin withthe leer" davies. They ae located inthef° join 88 eed 0 play Soudan vide Pr ysis te rina APL plying 00nd ie, somone ‘oc msnages ado sources and audio output on a device pnts ctaratlons vung development 60 your application ws aed Features. "ing MediaPlayer, make sue your manifest has the appropriate declarations W pret permission uc qsng MediaPlayer to stream network-based content, |, _ nissan idee Sep ae = msg ie Lock Permission ’ sour player application needs to Keep the screen from dimming or the processor from sleeping, or uses. the sn a eae cee a Guo svnission android sna@="aiidroidipermission. WARE LOCK"! : eiaPlayer class \« most important components of the media framework isthe MediaPlayer class. An object of this class can fetch, decode, 5 sodio and video with minimal setup. It supports several different media souces suchas “ul Rls, suchas ome you might obtain from a Content Resolver = teal URLs (reaming) Neos of MediaPlayer |e void seDatSoureeSting pat set the datasource (file path orapw) 0 we public oid a epars te ply for playback sychronos public void Sana it start or resumes the playback. public void stop tops the paytk sis oid pause ingest playa <= checks ifrmeda player is laying —_— specified ime in ilisecons Loli void seek Totin mils) ma a public void setL-ooping(boolean looping) sesh plays ot —— store iB ieee a uack forte specified i pubs oi seit inl) eee itst _poblc int getCurrent Poston) Fate bli int getDuraiond) —o | pubic void ‘eiVolumet float lefiVotume float ight VOlMm®)8-47 Releasing the MediaPlayer A MediaPlayer can consume valuable system resources. Therefore, you should always es rections ‘ot hanging on to a MediaPlayer instance longer than necessary, When you are done with it, you Iways call ‘any system resources allocated to it are properly released, ‘You can release the MediaPlayer as follows ‘mediaPlayer.release(); mediaPlayer = mull; Using MediaPlayer as a service If you want your media to play in the backs hile the user is interacting with other need to embed the MediaPlayer in a M activity Public cline MyService extends Service implements MediaPlayer OnPreparedListene Private static final String ACTION PLAY = “com.example.action,PLAY"; MediaPlayer mediaPlayer = qull; ground even when your application is not onscreen that is, you want jt applications then you must start a Service and control the MediaPlayer i fediaBrowserServi _ Publie int onStartCoramand(Intent intent, int flags, int startld) { 4 (intent.getAction().equals(ACTION_PLAY)) { 5S = wf iitiline it here ‘modiaPlayersetOnPreparedl.istene(thi): -mediaPlayer.prepareAsyne(); ‘7 prepare async tot block main thread\ideoView from | 1) ain.xmlregistering R out xmins:androclass="hitp://schem i t_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@d men/activity_horizontal_ margin’ Tech-Neo Publications There Authors inspire iauovationves puted soesped oes ped TextToSpeech "soo, you ean eonvert your text into speech by the help of TextToSpecch class. Aer completion of the conversion, you can poh or create the sound file, Consructor of TextToSpeech class: TeiteSpeech(G ethos of TextToSpeech Class, pk Son tex Nos Hai ps)% 5.5.1 Sensor EARN: Write the use of Sensor API, Sensors can be used to monitor the three-dimensional device movement or change in the environment of the rovides sensor API to work with different types of sensors. Sensor ¥. application Development (MSBTE-Sem cor C888 ' roid hardware Sensor class provides methods to get informati oo {0 get information of the sensor such as sensor name, sensor type, SEnS0r psorKivent lass cance is created by the system. I provides information about the sensor void omAccuracyChanged(Sensor sensor, int ‘oid onSensorChanged(SensorEvent event) accuracy) | it is called when sensor accuracy is changed. itis called when sensor valves are changed. sensor Example sue the sensor will print the Values of x, , and z axis. sctvity_mainsxm552 AsyneTask ot a aeaMnaRInRT Task enables proper and easy use of the UI thread. This class allows you to perform background operations and publish rests omnes yncTask class is firstly executed using execute() method. In the first step AsyncTask is called onPreExecute() thea ee seed of AsyneTask 5) default, our application code runs in our main thread and every statement is therefore execute in a sequence. If we need to fev long tasks/operations then our main thread is blocked until the corresponding operation has finished. For providing a good user ‘in our application we need to use AsyncTasks class that runs in a separate thread. This class will executes everything im ‘sbuteround() method inside of other thread which doesn't have access to the GUI where all the views are present. The ‘=PosExecutet) method of this class synchronizes itself again with the main UI thread and allows it to make some updating. This method ‘lbs auomatically after dhe dolnBackground method finished its work.‘Generic types of AsyncTask in android lne> AsyncTask
getBondedDevices() returns a set of paired (bonded) BluetoothDevice objects. ~ boolean startDiscovery() starts the discovery process. can perform fu : indamental 3 10 listen for connection Rae — ‘4S initiate device discovery, query a list of paired Ate a8 follows : 2uelooth Permissions \nordes to use Bluetooth features in your application, you must declare two permissions. The first ofthese is BLUETOOTH. ES ‘wt this pemnssion to perform any Bluetooth commonicaton, suchas requesting « conection, accepting @ conection, \nsferring data * ‘TION. Your app needs this permission because a Bluetooth The i ‘must declare is ACCESS_FINE_LOCA’ 5 coon main att the eatn ft TAs iran may cone om ee ove . “lls Bluetooth beacons in use at Jocations such as shops and transit foxesPD Jon android:name="android. permission. ACCESS_FINE_LOCATION", Setup Bluetooth = Before your application can communicate over Bluetooth, you need to verify that Bluctooth is supported on the. ‘ensure that itis enabled. ~ Get the BluetoothAdapter. ~The BluetoothAdapier is required for any and all Bluetooth activity. To get the BluetoothAdapter, call the satie ‘method, This retums a BlvetothAdapler that represents the device's own Bluetooth adapter (the Bluetooth Bluetooth adapter for the entire system, and your application can interact with it using this object. If ull, then the device doesn't support Bluetooth For example : BluctoothAdapter bluetoothAdapter = Bluetooth Adapter. getDefaultAdapter(s if (bluetoothAdapter == nll) { 1) Device doesn't support Bluetooth, i . ) * - Enable Bluetooth ‘You need to ensure that Bluetooth is enabled. Call isEnabled( to check whether Bluetooth is currently returms false, then Bluetooth is disabled. To request that Bluetooth be enabled, call. startActvityF ACTION. REQUEST_ENABLE intent action. This call issues request to enable Bluetooth through the system settings, ‘your application). For Example if (bluetoothAdapter.isEnabled)) { Intent enableBtintent = new ki eaters :&] Mobile Application Devolopment (MSBTE-Sem-6-Comp) 6-85 _ (/Toflate the menu; this udds item to the action bur if itis present. ‘getMenulnflater()inflate(R.menu.sctivity_main, menu); Animations can add visual cues that notify users abo state, such as when new conter ‘what's going on in your app. They are especially useful when loads or new actions become available. Animations also add a polished look 19 fives ita higher quality look and fee Android includes different animation APIs de maitt aY8 You can add mation to your UL. The Animaions Framework allows us to crate visually attractive “unsidons in our apps. Using the animations one can turn their good looking app into an excellent and highly usable {seo perform animation in android, we are going io cll a talc funtion loadAnmationd of the class Going to receive the result in an instance of Animation Object. Is syntax is as follows imation(getA pplicationContext(), nation you want, so this page provides an o Animation animation = AnimationUtils.JoadA ni im.myanimation); Modify sre/Main Activity ava file to add animation codeipentlped Co Handles)Methods of SaLiteDatabase class ‘There are many methods in SQLiteDatabase clas. Some of them areas follows void exeeSQLString sql) executes the sal query not select query, ong inser(String table String nullColumaHack, ContentValues| values) inserts a record on the database. The table gy same, nullColumnllack doesn‘ allow second argument is nul, android wil store pu are empy. The third argument specifies the vy int opdate(String table, ContentValues values, Sting whereClause, ‘Strng(} wherergs) updates a row, Cursor quen(String table, Stringl] columns, String selection, Stine] selctionArgs, Suing groupB, Suing having, Sting orderBy) How to view the data stored in sqlite in androld studio? Follow the folowing steps to view the database an its data t = Open File Explorer ~ Goto daa directory inside data directory, ‘Search for your application package name, Fetuns a cursor over the resultset. fred in android sitethe result st of query : ia pt ‘a database in Android. The Cursor class has an APL that allows “# sors are What conta the columns that were returned from the query as wel as iterate over the rows of the esa #t- jn atype-safe manner) ging Cursor Data read the column data fom Oe current row of data i ‘This weans Oat _ a cursor has been retumed from a daabass nally When a curs ‘y rows of data eam be ass provides Ane following methods to manipulates ioternal postion: an Corsoranovefint offset): Moves He postion bythe given offset 1 Cursor nove TOFS) = Moves the position tothe first row jan Cursor anoveT Las) = MOVES position to the last 0" seoean CursoramoveToNestO : Mov the relative tothe current postion -anoveToPosition(int position) = arsor ci boolean Cursor row relative tothe curent postion i for iterating ec) method returns a boolean 10 successful or nt. Tis gis wefta ‘ ee ee eee ae apanant (MARTE Bene. Comp) yared Syllabus ek SNS Telephony pol 6.1 SMS TELEP Suh Develop an android application for displaying phone information aa 2@, 64.2 Develop an android application to make a phone call, GA. 6.4.9 Write the cose to send SMS Iv android aa, Amati mobile stavioos ae provided with @ Phone app for making calls which includes a dialler for dialling a: android telephony syatom is a software fhamework that allow you t add services like yaice call ideo call Tivo package that contains those services ts ano, telephony and inetudes classes like SMS Manager, Telephony fron within the app ‘Thus the Tolophony clas provides aovess to information about the telephony services on the device Applications own we the mettoxts in this class to determine telephony services and states, as well as 10, subseribor information, Applications can alsi rogistor a listener tho detwalt subsoription forall cally Some of the important classes inclu Clow Name oll We ity Coll eentity represents the Meatity of « unique cell, Coll Signal Strength Abstract hase class for cell phone signal strength related information. Mins Downton Session, This class provides func Mus Group Call Session. : fs Phone State Listener - Service State Signal Strong Sinn Manager naManager nancies Subscription Manager is the application interface to Subscription Cot {information about the current Telephony Subscriptions. Provides access to information about the telephony services on the deviceBASED SERVICES project and Getting the maps API key the Google Maps servers. This key is ree and you can weit with any of your applications API, you must register your application on the Google Developer Console and enable the API. To oper Console follow the below steps Platform Console. Signin with your gmail account: hips:/console.developers.go0gle.com/project ect. You can create new project by clicking onthe Create Proc button and give name fo your project.Meow Accncance q prema temp torn ey et mh ‘Teck Neo Publications Where Authors inspire ianorationWisk Sericee 4} dantuntmowas‘The API key created dialog displays your newly created API key. Copy the key and save for further use API key created 7. Click Close. Adding the maps API key ~ In AndroidManifest.ml, add the following element as a child of the
element, by inserting it just
tag: 5‘ 0 Yona A mo ee ee coe hace YOUR APL Key op APL tthe ie yn wy An " Map | ven lich Mea ‘nt ay ty tetera pe whee een) saga ba vale ex axe yur Cope Mas AP ey atich we ne ne&) "> Note : The above example is the default example of displaying map which uses ‘Studio and the latitude and longitude are sot to the coordinates of sydney. You can, peer the location you want to show in map YA 6.2.3 Types of Google Maps ‘The Google Maps Android API offers five types of mi = Normal : Typical road map. Shows roads, some features buill by humans, and important natural features feature labels are also visible = Hybrid : sa - sal pels are also visible. lite photograph data with road maps added. Road and feature lite : Satellite photograph data. Road and feature labels are not visible. ines and labels, and perspective shading. So Terrain : Topographic data. The map includes colors, cont also visible = None : No tiles. The map is rendered as an empty grid with:no tiles loaded. GoogleMap. For example. hers how to display a hybrid map: GoogleMap map: 1/ Sets the map type to be “hybrid” ‘Map setMapType(GoogleMap.MAP_TYPE_HYBRID); % 6.2.4 Displaying the Zoom Control ee = The zoom level of the camera determines the scale of the map. Athigher 200m levels more detail can be seen on the screen, while at lower 200m levels more ofthe world ‘The 200m level doesn't need to be an integer. The range of zoom levels that the map permits depends ‘mp type, and screen size. The following list shows the approximate level of detail you can expect 10 See 1: World 5: Landmass/continent 10: City 15: Streets 20: Buildings ‘You can enable or disable the zoom gestures inthe map by calling the _ setZoomControl ‘Syntax :googleMap getUiSettings()stZoomGesturesEnabled(rue); ‘Syntax : googleMap getUiSettings() setRotateGesturesEnabled(true); Tech-Neo Publications Where Authors inspire nmoationthe navigation to Connaught Palace New Dei fo driving by ca then Connaught + Palace +New-+Deli DelhiSmode= cca standard cn, common on Gone NAS and fel Ks possible to change the co clr mae of cpl Map addMarkernakerOpsions) mets van arf se with ene bE aed tothe map withthe G cts of type Marker, and ae etal, jet vgn te incr ese ena postion ofthe marker ‘Use Tong pres to activate the allows the user to change the oth up, ivng he wer ck es 10 HEpplication Development (MSBTE-Sem-6-Comp) ‘sgleMap.achiMarker(new MarkerOptions() “prition( new Lathang(87A233438,-122.0728817)) stile(Linkedtn") h leMap.addMarker(new MarkerOptions() gence Latling(37.4629101,-122.2449098)) title("Facebook”) -Anippet("Facebook HQ: Menlo Park”); sprogleMap.addMarker(new MarkerOptions() _position(new LatL.ng(37.3092293,-122.1136845)) Aitle(*Apple”)); ? Getting location ‘To get the current location we need to implement following interfaces and their callback methods: Callback methods in Google Map ~ OnMapRreadyCallback : This callback interface invokes whea it instance is set oa MapE ooMapReady(GoogleMap) method of OnMapReadyCallback interface is called when the map is oaMapReady(GoogleMap) method we can add markers, listeners and other attributes. ~ _ T@entlonlistener = This interface i used to reccive noification when the device location bss changed" ‘ecationListener onLocationChanged(Location) is called whe the location has changed. GeorteApiCtent-ComsectionCaliects : This imerface’ peovite|lcaiibases Se onConnectionSuspended(int) which are called when the device is to connected and disconnected, ~ _ GeosieApiCllent.OnConnectionFailedListener : This interface provide callbacks method ‘hich is called when there was an error in connecting the device to the service. [Rx ‘
‘
‘Soction android:name="android.intent.action MAIN" /> maps > -
‘ ‘S/activity> ae Geocoding isthe process of converting addresses (like a stet address) into geographic coordinates (like hic you can set place markers ona map, or position the map. Reverse geocoding isthe process of converting geographic coordinates into a hunan-eadabe address. = Yow can also use the Geocoding AP to find the adres fora gven pace ID.io inp! Geoeating a revene Gecodiag is Osc — sy ned 1 impor prope packages Imprt anid atin Gender, setors and methods that canbe used withthe Geoeder clas ae: : ost Goode Cofet content, Lae locale) + Constructs Goede whose esponts wl be loa fr the ive Lae 7 Geode Comtet context) ‘constets 1 Geocode whos sponses wl be lied fre detain LONE tums an aay of Adresses ha | vse i, Teeand”, an adress soch ‘Dalihas moved across a predefined geography ‘or geofence. Depending upon the needs of your application, you can choose between several ways of working With follows: : ~The My Location layer provides a simple way to display a device's location on the map. 1t does not provide data, a = The Google Play services Location API is recommended for all programmatic requests for location daa, oe = The LocationSource interface allows you to provide a custom locatior provider. = If your app needs to access the user's location, you must request permission by adding the relevant Android loc your app, = Android offers two location permissions: ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION, choose determines the scuracy of the location retuned by th API. You only ned 10 request O96 te Permissions, depending on the level of accuracy you need: ~ android permission, ACCESS_COARSE_LOCATION ~ Allows the API to use WiFi or mobife cell data (orb device's location, The API returns the location with an accuracy approximately equivalent toa city block. location providers, including the Global Positioning System (GPS) as well as WiFi and mobile cell data, — Permission can be added tothe manifest file as “
~ Android 6.0 (Marshmallow) introduces a new model for handling permissions, which streamlines the process for see install and upgrade apps If your app supports the new permisions model and the device is running Andéoid 6.0 (N ler, the user does not ave to grant any permissions when they isl or upgrade the app. The app mut che necessary permission at runtime, and request the permission the permission,‘The Google Play services Location API = The Google Location Services API prt of Google Play Services, provides @ more rowerful, high-level tasks such as location provider choice and power management = The Google Play services Location API is the prefered method for adding location awareness 10 your includes functionality that lets you © Determine the device location © Listen fr location changes. © Determine the mode of transportation, ifthe device is moving. © Create and monitor predefined geographical regions, known as geofences, In Andi, Goole provides via Google Ply Services an API or automated lcatien tracking ofthe poson of ‘mobile device. This sth Fuse Location Provider API Example Code for activity_main.xml <2 version="1.0" encoding "ui 8°? ‘
You might also like
CH 5 0203 PDF
PDF
No ratings yet
CH 5 0203 PDF
89 pages
Chapter 5 Mad
PDF
No ratings yet
Chapter 5 Mad
105 pages
Unit-5 - Activity - Mulitmedia With Databases
PDF
No ratings yet
Unit-5 - Activity - Mulitmedia With Databases
150 pages
MAD Chap 5
PDF
No ratings yet
MAD Chap 5
101 pages
Mad - UNIT 5-1
PDF
No ratings yet
Mad - UNIT 5-1
77 pages
Mad Unit 5
PDF
No ratings yet
Mad Unit 5
14 pages
Mobile Application Programming: 04 Activity, Intent and Fragments
PDF
No ratings yet
Mobile Application Programming: 04 Activity, Intent and Fragments
74 pages
Mad Unit-3
PDF
No ratings yet
Mad Unit-3
45 pages
Unit 5
PDF
No ratings yet
Unit 5
83 pages
Unit 05 - MAD New
PDF
No ratings yet
Unit 05 - MAD New
22 pages
Chapter Two: Android Application Fundamentals
PDF
No ratings yet
Chapter Two: Android Application Fundamentals
29 pages
Mad Unit-2
PDF
No ratings yet
Mad Unit-2
24 pages
Unit V - Activity and Multimedia With Databases
PDF
No ratings yet
Unit V - Activity and Multimedia With Databases
72 pages
Intent
PDF
No ratings yet
Intent
20 pages
Unit Iii
PDF
No ratings yet
Unit Iii
57 pages
Chapter Four
PDF
No ratings yet
Chapter Four
42 pages
Mobile Application Development: Lecture # 8
PDF
100% (1)
Mobile Application Development: Lecture # 8
14 pages
Using Activities, Fragments and Intents in Android: Prof. Shardul Agravat
PDF
100% (1)
Using Activities, Fragments and Intents in Android: Prof. Shardul Agravat
34 pages
Intents Updated
PDF
No ratings yet
Intents Updated
41 pages
Unit - V Activity and Multimedia With Databases Unit Outcome
PDF
No ratings yet
Unit - V Activity and Multimedia With Databases Unit Outcome
33 pages
Chapter 7 Android - Intents and Filters
PDF
No ratings yet
Chapter 7 Android - Intents and Filters
31 pages
UNIT-2 Activities, Fragments and Intents
PDF
No ratings yet
UNIT-2 Activities, Fragments and Intents
44 pages
Mad Unit 3
PDF
No ratings yet
Mad Unit 3
21 pages
Week 3 Activities Intent
PDF
No ratings yet
Week 3 Activities Intent
34 pages
Intents
PDF
No ratings yet
Intents
4 pages
Unit No.5
PDF
No ratings yet
Unit No.5
67 pages
12 Android Intents and Filters
PDF
No ratings yet
12 Android Intents and Filters
21 pages
02 Android Basics
PDF
No ratings yet
02 Android Basics
36 pages
Slide 3 - Fundamental Component
PDF
No ratings yet
Slide 3 - Fundamental Component
65 pages
Lap Trinh Androi 25 3863
PDF
No ratings yet
Lap Trinh Androi 25 3863
6 pages
MAD Unit-5
PDF
No ratings yet
MAD Unit-5
213 pages
Note 1468912113
PDF
No ratings yet
Note 1468912113
126 pages
Chapter 2-Android Application Fundamentals
PDF
No ratings yet
Chapter 2-Android Application Fundamentals
32 pages
2.using Intents
PDF
No ratings yet
2.using Intents
17 pages
Intents
PDF
No ratings yet
Intents
6 pages
Intents
PDF
No ratings yet
Intents
9 pages
Intents and Broadcast Receivers: Dr. David Janzen
PDF
No ratings yet
Intents and Broadcast Receivers: Dr. David Janzen
14 pages
UNIT4
PDF
No ratings yet
UNIT4
105 pages
Intent
PDF
No ratings yet
Intent
5 pages
Android Application Model (3) : © Frank Mueller & Seokyong Hong (TA)
PDF
No ratings yet
Android Application Model (3) : © Frank Mueller & Seokyong Hong (TA)
45 pages
Chapter 5MAD
PDF
No ratings yet
Chapter 5MAD
192 pages
Mad Unit5
PDF
No ratings yet
Mad Unit5
22 pages
Unit-2 Notes MAD
PDF
No ratings yet
Unit-2 Notes MAD
15 pages
Mobile Computing: Intents, Intent-Filters
PDF
No ratings yet
Mobile Computing: Intents, Intent-Filters
21 pages
4.1 Activities 1
PDF
No ratings yet
4.1 Activities 1
17 pages
Programaci On en Android: Universidad Aut Onoma de Tamaulipas Facultad de Ingenier Ia y Ciencias
PDF
No ratings yet
Programaci On en Android: Universidad Aut Onoma de Tamaulipas Facultad de Ingenier Ia y Ciencias
28 pages
Mobile Application Development Unit 3
PDF
No ratings yet
Mobile Application Development Unit 3
7 pages
Mobile Application and Development-Lec6
PDF
No ratings yet
Mobile Application and Development-Lec6
11 pages
MAD Handbook
PDF
No ratings yet
MAD Handbook
172 pages
1.working With Activities
PDF
No ratings yet
1.working With Activities
7 pages
Chapter 5 Intent and Fragments
PDF
No ratings yet
Chapter 5 Intent and Fragments
19 pages
Chapter 5-Activity and Multimedia With Databases
PDF
No ratings yet
Chapter 5-Activity and Multimedia With Databases
32 pages
Mobile Application Development
PDF
No ratings yet
Mobile Application Development
52 pages
Android Mobile Technology
PDF
No ratings yet
Android Mobile Technology
20 pages
Android Theory
PDF
No ratings yet
Android Theory
8 pages
Activities and Intents
PDF
No ratings yet
Activities and Intents
57 pages
Mad 3
PDF
No ratings yet
Mad 3
16 pages
Intents Lecture7
PDF
No ratings yet
Intents Lecture7
15 pages
03 Android Basic Components PPTX 110129014912 Phpapp02
PDF
No ratings yet
03 Android Basic Components PPTX 110129014912 Phpapp02
85 pages