Home Forum
Welcome, Guest
Username Password: Remember me

Application permissions
(1 viewing) (1) Guest
Discussion related to creating Android software
  • Page:
  • 1

TOPIC: Application permissions

Application permissions 3 years, 5 months ago #24

I keep seeing in the android documentation references to the permissions, apparently you have to set them in the manifest, how do you do this?

Also is it the same as J2ME, do you have to have an appropriate certificate before the permissions are allowed?
  • marvin
  • OFFLINE
  • Professor
  • Posts: 18
  • Karma: 0

Re:Application permissions 3 years, 5 months ago #27

Yes that is correct. You set the permissions you need in the AndroidManifest.xml by adding a <uses-permission> tag for every call that need special permissions to run.

Here is a example
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.app.myapp" >
 
<uses-permission android:name="android.permission.RECEIVE_SMS" />
 
</manifest>



Whether you are granted the permission is up to the user at install time where the user is prompted to accept or decline your permission requests. This question will not be asked at runtime.

If you get denied the permission a security exception MAY be thrown so be watchful for that.

Read more about it here http://code.google.com/android/devel/security.html

For your question on certificates there is quite different from J2ME. Every application MUST be signed but the certificate does not have to come from a certificate authority so self signed apps are ok to use. With J2ME the cert will grant you different right but this is not the case with Android. All its for is to develop trust relationships between applications, so to allow different apps to interact with each other.

Hope this will help.
  • sthlm
  • OFFLINE
  • Professor
  • Posts: 5
  • Karma: 0

Re:Application permissions 3 years, 5 months ago #29

A very common problem is to write an app which needs an internet connection and forget to put the required entry in AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET"></uses-permission>

When you do this its puzzling for a while as the error dosn't jump out at you as clearly as you'd like
  • ticktock
  • OFFLINE
  • Professor
  • Posts: 79
  • Karma: 6

Re:Application permissions 2 years, 9 months ago #161

When using example code watch out for legacy XML such as:

Dont use

<permission android:name="android.permission.INTERNET"></permission>

Rather use

<uses-permission android:name="android.permission.INTERNET"></uses-permission>

Just double check with the current version of the documentation
  • mmoore
  • OFFLINE
  • Examiner
  • Posts: 22
  • Karma: 1
  • Page:
  • 1
Time to create page: 0.24 seconds
Copyright © 2012 Android Academy. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.
 
Glossary
We have 31 guests online