Problem with permission to run an activity

This is a discussion on Problem with permission to run an activity within the Beginning Developers forums, part of the Android Development category; Hello everyone! I`m trying to understand, how permissions work in android. I made simple project for that. My problem is: 1) I define permission to ...

Results 1 to 2 of 2

Thread: Problem with permission to run an activity

  1. #1
    Android Lurker Evg64's Avatar
    Join Date
    Aug 2011
    Posts
    4

    Problem with permission to run an activity

    Hello everyone! I`m trying to understand, how permissions work in android. I made simple project for that. My problem is:
    1) I define permission to my activity (activity name is "AndroidTestActivity", permission name is "android.permission.MY_PERMISSION"),
    2) I define uses-permission for my activity (<uses-permission android:name="android.permission.MY_PERMISSION"></uses-permission>),
    3) When I run AndroidTestActivity, my logcat says:
    Code:
    08-19 19:39:18.311: WARN/ActivityManager(59): Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.Android.Test/.AndroidTestActivity } from null (pid=-1, uid=-1) requires android.permission.MY_PERMISSION
    Why do I get Permission Denial? I made uses-permission, isn`t it enough?
    Here is AndroidManifest source:
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.example.Android.Test" android:versionCode="1"
        android:versionName="1.0">
        <uses-sdk android:minSdkVersion="7" />
        <permission android:name="android.permission.MY_PERMISSION" android:protectionLevel="normal"></permission>
        <uses-permission android:name="android.permission.MY_PERMISSION"></uses-permission>
    
        <application android:icon="@drawable/icon" android:label="@string/app_name">
            <activity android:name=".AndroidTestActivity" android:permission="android.permission.MY_PERMISSION"
            android:label="Sample menus application">
                 <intent-filter> 
                     <action android:name="android.intent.action.MAIN"/>
                     <category android:name="android.intent.category.LAUNCHER" /> 
                 </intent-filter> 
            </activity>
        </application>
    </manifest>
    Here is AndroidTestActivity source:
    Code:
    package com.example.Android.Test;
    
    import android.app.Activity;
    
    public class AndroidTestActivity extends Activity {
        TextView tv;
        Menu myMenu=null;
        @Override
        public void onCreate(Bundle savedlnstanceState) {
            super.onCreate(savedlnstanceState);
            setContentView(R.layout.main);
        }
    }

  2. Android.net is the premier Android Forum. Registered users do not see these ads. .

  3. #2
    App Developer alostpacket's Avatar
    Join Date
    Jan 2011
    Location
    NY
    Posts
    240
    Thanked
    32 times
    Twitter
    alostpacket
    uses-permission should come after the closing /application tag but before the closing /manifest tag

Remove Ads

http://www.scramblerducati.org/

Sponsored Links

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Similar Threads

  1. MMS Problem?
    By mattywing in forum Samsung Galaxy S2
    Replies: 0
    Last Post: 07-11-2011, 07:44 AM
  2. Multiple activity in same tab.
    By pavan in forum Android Forum
    Replies: 2
    Last Post: 06-01-2011, 06:18 PM
  3. ttyUSB Permission issues
    By PSB49 in forum Rescue Squad Help
    Replies: 0
    Last Post: 05-31-2011, 07:44 AM
  4. Wi-fi problem
    By Jef-Droid in forum Motorola Droid X
    Replies: 6
    Last Post: 02-14-2011, 10:42 PM

Search tags for this page

activity permission android
,
activitymanager permission denial
,
activitymanager starting intent act=android.intent.action.main cat= android.intent.category.launcher
,
activitymanager: starting: intent { act=android.intent.action.main
,
activitymanager: starting: intent { act=android.intent.action.main cat=[android.intent.category.launcher]
,
android intent.category home permission denial
,
android permission denial: starting intent { act=android.intent.action.main
,
android permission: null
,
android test project permission denial
,
launch another app permission denial: starting intent
,

permission denial starting intent requires null

,

permission denial: starting intent { act=android.intent.action.main cat=[android.intent.category.home]

,

permissions in activity android

,
start {act=android.intent.action.main cat=[android.intent.category.home]
,
uses-permission tag appears after application tag warning
Click on a term to search our sites for related topics.
Android Forum