Permission not needed


Last Updated:

  1. colsanders83

    colsanders83 New Member This Topic's Starter

    Joined:
    Sep 2, 2010
    Messages:
    4
    Likes Received:
    0
    Hi All,

    I'm in the middle of learning about permissions for Android. I built a basic app that launches a web page using the following code;

    Code (Text):
    1.         Uri uri = Uri.parse("http://www.google.com");
    2.         Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    3.         startActivity(intent);
    I have no permissions at all in the manifest, yet, the web page launches without any issues. Should this fail when I launch? (Or at least asked permission when I install?)

    Is "debuggable" bypassing this requirement?

    Thanks in advance for any help.
     

    Advertisement
  2. id0001

    id0001 Well-Known Member

    Joined:
    Apr 20, 2010
    Messages:
    142
    Likes Received:
    23
  3. colsanders83

    colsanders83 New Member This Topic's Starter

    Joined:
    Sep 2, 2010
    Messages:
    4
    Likes Received:
    0
    Thanks for the reply.

    I removed that code and added the following;

    Code (Text):
    1.         ContentResolver cr = getContentResolver();
    2.         Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
    3.         int count = cur.getCount();
    4.         Toast.makeText(contect, Integer.toString(count), Toast.LENGTH_LONG).show();
    This code crashes if I don't have permission (stopped unexpectedly error, not a permission error.) and runs if I add

    Code (Text):
    1. <uses-permission android:name="android.permission.READ_CONTACTS"></uses-permission>
    to the manifest. The other weird thing is it never asks me for permission, it apparently just grants it.
     
  4. JiMMaR

    JiMMaR Well-Known Member

    Joined:
    Jun 12, 2010
    Messages:
    363
    Likes Received:
    57
    don't think it'll ask you for permissions in debugging mode (on phone or emulator) but get the apk and install it manually , it should state the permissions before you press on install
     
  5. colsanders83

    colsanders83 New Member This Topic's Starter

    Joined:
    Sep 2, 2010
    Messages:
    4
    Likes Received:
    0
    Thanks for the reply. I tried manually installing via the command line, but get the same results. Is there a setting somewhere that makes the .apk file a "production" file?
     
  6. JiMMaR

    JiMMaR Well-Known Member

    Joined:
    Jun 12, 2010
    Messages:
    363
    Likes Received:
    57
    via command line ? why ? :S
    actually , do you know where the permissions are asked ? it's when you press on the file in the phone , you get a page with all the permissions and install/cancel
     
  7. colsanders83

    colsanders83 New Member This Topic's Starter

    Joined:
    Sep 2, 2010
    Messages:
    4
    Likes Received:
    0
    I've tried both the command line and via Eclipse. In either case clicking on the file just launches it. If I look at the file via "settings" it says it can access private data, but never asks me to allow it.
     
  8. kevin@teslacoilsw

    kevin@teslacoilsw VIP Member VIP Member

    Joined:
    Jun 13, 2010
    Messages:
    183
    Likes Received:
    130
    When installing the app through debugging tools it just installs without prompting. When installing normally (Via Market or via the Package Installer on the phone that's called via Astro or similar) it will display the permissions before installing.
     
    colsanders83 likes this.

Share This Page

Loading...