Your Android app doesn’t need that many permissions

Your Android app doesn’t need that many permissions

Android system permissions can be a bit confusing from a user's perspective. Sometimes you may only need to do something simple (edit a contact's information), but you apply for permissions that far exceed what your app needs (such as permission to access all contact information).

It is hard not to make users wary of you. If your app is closed source, users have no way to verify whether your app is uploading his contact information to the app server. Even if you explain to users why you are applying for this permission, they may not believe you. So when I developed Android apps in the past, I avoided using some tricks because it would require additional permissions and users would not trust you.

After practicing for a while, I have come to realize that you don't necessarily need to apply for permissions to complete certain operations.

For example, there is a permission in Android: android.permission.CALL_PHONE. You need this permission to call the dialer from your app, right? The following code is how you make a call, right?

  1. Intent intent = new Intent(Intent.ACTION_CALL);
  2. intent.setData(Uri.parse( "1234567890" ))
  3. startActivity(intent);

Wrong! This permission allows your phone to make calls without user input! This means that if my app uses this permission, I can make harassing calls at 3 a.m. every day without your knowledge.

In fact, the correct way to do it is this - use ACTION_VIEW or ACTION_DIAL:

  1. Intent intent = new Intent(Intent.ACTION_DIAL);
  2. intent.setData(Uri.parse( "1234567890" ))
  3. startActivity(intent);

The appeal of this solution is that your application does not need to apply for permissions. Why not? Because the Intent you use will start the dialer and pre-dial the number you set. Compared with the previous solution, the user still needs to click "Dial" to make a call. Without the user's participation, the call cannot be made. To be honest, this makes me feel good. Nowadays, many applications request permissions that make people feel overwhelmed.


Another example: I wrote an app called Quick Map for my wife, which was primarily a response to her complaints about existing navigation apps. She just wanted a list of her contacts and a route to where they were.

Seeing this, you may think that I need to apply for access to all contact information to complete this application: Hahaha, you are wrong again! If you read my source code, you will know that I actually used the ACTION_PICK Intent to start the relevant application to obtain the contact address:

  1. Intent intent = new Intent(Intent.ACTION_PICK);
  2. intent.setType(StructuredPostal.CONTENT_TYPE);
  3. startActivityForResult(intent, 1 );

This means that my app does not need to apply for permissions, and does not require additional UI. This greatly improves the user experience of the app.


In my opinion, one of the coolest parts of Android is its Intent system. Because Intent means I don't need to implement everything myself. Each application will register with Android the data area it is good at handling, such as phone numbers, text messages or contact information. If an application needs to solve everything, then the application will become very bloated.

Another advantage of the Android system is that I can use the permissions requested by other applications, so my application does not need to apply again. The above two points in the Android system can make your application simpler. The dialer needs permissions to make calls, but I only need an intent to make a call, which does not require permissions. Because users trust the dialer that comes with Android, but do not trust my application, this is good.

The point of writing this blog is that before you apply for permissions, you should at least read the official documentation about Intent to see if you can complete your operation through other applications. If you want to know more in depth, you can study this official document about permissions, which introduces more detailed permissions.

In short, using fewer permissions not only allows you to gain more user trust, but also provides users with a good user experience.

source:Dan Lew I don't need your permission!

<<:  In-depth analysis of Android's custom layout

>>:  Apple releases iOS 8.1.2 update: Input method bug still exists

Recommend

How to increase website traffic? 100 Ways to Increase Website Traffic

1. Add a blog to your website. If your website is...

Girl, let's learn programming together

When we mention the word "programmer", ...

The Gatekeeper of Light: How Polarized Lenses Tame Glare

Imagine that you are a little detective with a pa...

Practical plan for the operation of beauty salons!

1. Market Research 1. Merchant Analysis Located i...

How to design an online traffic-generating activity from scratch?

I was slapped in the face by Double 11. I think t...

All-new Lexus LS spy photos revealed, debut in early 2017

The current Lexus LS has been launched for more t...

How many steps are there to distinguish between "aviation" and "aerospace"?

Review expert: Qian Hang, aerospace science exper...

Nokia's return to Android: This launcher is pretty good

Nokia's move to launch an Android phone shocke...

If you want to watch birds, you no longer have to wait by the window!

Author: Duan Yuechu In today's era of integra...

MINISO’s private domain traffic growth method

In 2020, the offline industry was hit by the epid...

How to design a viral product?

In 2010, Sean Ellis proposed the concept of "...

Youku tests smart hardware to expand IP diversification

The ultimate goal of video production is to achie...