PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, November 6, 2022

[FIXED] How I can check if user accepted permission for read/write Contacts?

 November 06, 2022     android, contacts, permissions, screen     No comments   

Issue

my app read contacts from cell phone so when it run he get for permission.

How I ask again or check if the user gave permission?

Thank you very much.


Solution

User's don't really have the option to chose which permissions they approve or not. It's either they approve everything and your app installs, or they chose to decline and then your app doesn't install.

However, to answer your question you can use the checkPermission method in the PackageManager

PackageManager manager = getPackageManager();
int hasPermission = manager.checkPermission ("android.permission.READ_CONTACTS", "com.your.package")
if (hasPermission == PackageManager.PERMISSION_GRANTED) {
    //you have permission
}


Answered By - Frank Sposaro
Answer Checked By - David Marino (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing