1. Check out our app, Forums for Android! Download and leave feedback here!

Permission not needed

Discussion in 'Application Development' started by colsanders83, Sep 2, 2010.

  1. colsanders83

    colsanders83 New Member
    Thread Starter
    5

    Sep 2, 2010
    4
    0
    5
    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
    38

    Apr 20, 2010
    142
    23
    38
    Student.. also software developer
    Netherlands
  3. colsanders83

    colsanders83 New Member
    Thread Starter
    5

    Sep 2, 2010
    4
    0
    5
    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
    53

    Jun 12, 2010
    363
    57
    53
    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
    Thread Starter
    5

    Sep 2, 2010
    4
    0
    5
    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
    53

    Jun 12, 2010
    363
    57
    53
    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
    Thread Starter
    5

    Sep 2, 2010
    4
    0
    5
    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 Well-Known Member
    68

    Jun 13, 2010
    183
    130
    68
    WidgetLocker developer
    Chicago
    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...