• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Permission not needed

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:
        Uri uri = Uri.parse("http://www.google.com");
        Intent intent = new Intent(Intent.ACTION_VIEW, uri);
        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.
 
Thanks for the reply.

I removed that code and added the following;

Code:
        ContentResolver cr = getContentResolver();
        Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
        int count = cur.getCount();
        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:
<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.
 
Upvote 0
Thanks for the reply.

I removed that code and added the following;

Code:
        ContentResolver cr = getContentResolver();
        Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
        int count = cur.getCount();
        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:
<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.

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
 
Upvote 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?

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
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones