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

2019 Advertising Monetization Insights Report!

In this article, we will continue to provide you ...

Things you need to know about Android push notifications

Some time ago, the "Unified Push Service All...

Can cats also get Down syndrome?

March 21 is World Down Syndrome Day, also known a...

How to quickly develop a marketing plan from 0 to 1

After years of development, with the emergence an...

A universal formula for increasing followers on Xiaohongshu!

In the process of analyzing nearly 100 bloggers, ...

What will the next iPad Pro have? MiniLED screen, 5G, and two updates a year?

Although Apple just updated the iPad Pro in March...

3 models + 5 methods of data operations!

Many friends who are just getting started with da...

Prosecutors reveal the "four crimes" of Alipay fraud

With the increasing number of Alipay users, crimin...

Momo's new growth point and monetization rules

In the past ten years, Momo has still not been ab...

The 2016 death list of e-commerce and physical stores!

During this year’s Double 11, Uniqlo’s Tmall flag...

Can animals recognize themselves in a mirror? The answer is surprising →

Attention, pet owners, bring your pets and look h...

The next "Earth"? Scientists discover a new habitable planet

Among the issues that the public is most concerne...