Permissions

Permissions - Permissions   Applications can protect...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Permissions   Applications can protect resources & data with permissions   Applications statically declare permissions   Required of components interacting with them   Required by components they interact with   Android requires users for consent to specific permissions when application is installed   Applications can define permissions in an AndroidManifest.xml file <! ­ ­ Allows access to the vibrator  ­ ­> <permission android:name="android.permission.VIBRATE” … />   Applications can require components interacting with them to have a specified permission by setting android:permission attribute in AndroidManifest.xml   By default, permissions apply to all components hosted by the application   AndroidManifest.xml <manifest> … android:permission=“android.permission.VIBRATE” . . .> <application … </application> </manifest>   Individual components can set their own permissions   These override application ­level permissions   Restricts which components can start the associated activity   Checked within execution of   startActivity()   startActivityForResult()   Throws SecurityException on permissions failure   Restricts which components can start or bind to the associated service   Checked within execution of   Context.startService()   Context.stopService()   Context.bindService()   Throws SecurityException on permissions failure   Restricts which components can send broadcasts to the BroadcastReceiver   Checked after Context.sendBroadcast() returns   Does not throw SecurityException on permissions failure   Restricts which components can read & write the data in a ContentProvider   Will discuss in more detail later, when we cover ContentProviders   Applications specify permissions they use <manifest … > … <uses ­permission android:name="android.permission.VIBRATE”> </uses ­permission> … </manifest >   User must accept permissions before the package can be installed   Can a calling process access a Service?   Context.checkCallingPermission()   Does a given processes have specific permissions?   Context.checkPermission(String, int, int)   Does a given application have specific permissions?   PackageManager.checkPermission(String, String)   Others to be discussed in later lectures ...
View Full Document

Ask a homework question - tutors are online