Tags down


How to detect android.permission.USE_SIP

By : Ramesh
Date : October 14 2020, 02:21 PM
wish helps you Now I have a serious problem with my manifest. I don't know why even after had android.permission.USE_SIP in manifest, this is not recognized. I use this code to detect. , this is a part of code that that resolve the problem
code :
/** initialisation du SIP*/
       if (ContextCompat.checkSelfPermission(this, Manifest.permission.USE_SIP)
               == PackageManager.PERMISSION_GRANTED){
           ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.USE_SIP}, 0);

Share : facebook icon twitter icon

Facebook 3.0 : How to detect user cancel the permission dialog on android

By : Rafael17
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , First things first: the question is a bit old and this answer assumes you are using a more recent version (I'm using 3.7 at the moment). It might be possible to do this using the 3.0 version of the SDK, but you should try and update the Facebook SDK that you are using in your project to a newer version as they have added quite a lot features and fixes since 3.0.
I'm using a Session.StatusCallback to listen for Session lifecycle changes, which I register to a UiLifecycleHelper that provides the updates for my activity.
code :
public void call(Session session, SessionState state,Exception exception) 
    if(exception != null)
        if(exception instanceof FacebookOperationCanceledException)
            //make sure we don't continue posting
            posting = false;
            //the user cancelled it, no need to show a message or do anything
        else if(exception instanceof FacebookAuthorizationException)
            Toast.makeText(FacebookActivity.this, "Failed to obtain Facebook permission to post on your behalf", Toast.LENGTH_LONG).show();
            //don't continue posting, let the user retry it if he/she wants to
            posting = false;

    //continue with checking that all permissions have been granted and post the action
//I'm returning null further down the line because
//this code is run in an AsyncTask<Void,Void,Void>

Request request = new Request(
Response response = request.executeAndWait();
GraphObject responseObject = response.getGraphObject();

if(responseObject == null)
    FacebookRequestError fbre = response.getError();
    if((fbre!=null) && (fbre.getCategory() == Category.PERMISSION))
        return null;
        return null;

Can I detect that a particular permission has been removed for my android app?

By : 10v
Date : March 29 2020, 07:55 AM
will help you There is no broadcast, but you can check permissions yourself on startup(or resume, etc). Context#checkCallingOrSelfPermission() is provided for this.
If you want to check all your permissions, you could do something like this:
code :
public static boolean[] getPermissionsGranted(Context context, String[] permissions){
    boolean[] permissionsGranted = new boolean[permissions.length];
    for(int i=0;i<permissions.length;i++){
        int check = context.checkCallingOrSelfPermission(permissions[i]);
        permissionsGranted[i] = (check == PackageManager.PERMISSION_GRANTED);
    return permissionsGranted;

Android M detect if permission dialog is visible

By : unni krishnan
Date : March 29 2020, 07:55 AM
seems to work fine How can I determine programmatically if a permission dialog is visible to the user so I know what to do in this case?
code :
protected void onStart() {
        ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
        ComponentName cn = am.getRunningTasks(1).get(0).topActivity;
        if ("com.android.packageinstaller.permission.ui.GrantPermissionsActivity".equals(cn.getClassName())){
            //permission dialog is displayed

Android: Permission Denial: starting Intent with revoked permission android.permission.CAMERA

By : John
Date : March 29 2020, 07:55 AM
around this issue hi you can use these permission in your manifest file with other permission,
code :
    android:required="true" />
    android:required="false" />

//requests for runtime time permissions

 String CAMERA_PERMISSION = android.Manifest.permission.CAMERA;



// for security permissions
private int mDialogType;
private String mRequestPermissions = "We are requesting the camera and Gallery permission as it is absolutely necessary for the app to perform it\'s functionality.\nPlease select \"Grant Permission\" to try again and \"Cancel \" to exit the application.";
private String mRequsetSettings = "You have rejected the camera and Gallery permission for the application. As it is absolutely necessary for the app to perform you need to enable it in the settings of your device.\nPlease select \"Go to settings\" to go to application settings in your device and \"Cancel \" to exit the application.";
private String mGrantPermissions = "Grant Permissions";
private String mCancel = "Cancel";
private String mGoToSettings = "Go To Settings";
private String mPermissionRejectWarning = "Cannot Proceed Without Permissions</string>
<string name="explanation_permission_location_request">We are requesting the location permission as it is necessary for the app to perform search functionality properly.\nPlease select \"Grant Permission\" to try again and \"Cancel \" to deny permission.";
// type of dialog opened in MainActivity
 @IntDef({DialogType.DIALOG_DENY, DialogType.DIALOG_NEVER_ASK})
 @interface DialogType {
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
    switch (requestCode) {
            if (grantResults[0] == PackageManager.PERMISSION_GRANTED && grantResults[1] == PackageManager.PERMISSION_GRANTED && grantResults[2] == PackageManager.PERMISSION_GRANTED) {
                // Call your camera here.
            } else {
                boolean showRationale1 = shouldShowRequestPermissionRationale(CAMERA_PERMISSION);
                boolean showRationale2 = shouldShowRequestPermissionRationale(READ_EXTERNAL_STORAGE_PERMISSION);
                boolean showRationale3 = shouldShowRequestPermissionRationale(WRITE_EXTERNAL_STORAGE_PERMISSION);
                if (showRationale1 && showRationale2 && showRationale3) {
                    //explain to user why we need the permissions
                    mDialogType = ValueConstants.DialogType.DIALOG_DENY;
                    // Show dialog with 
                    openAlertDialog(mRequestPermissions, mGrantPermissions, mCancel, this, MyActivity.this);
                } else {
                    //explain to user why we need the permissions and ask him to go to settings to enable it
                    mDialogType = ValueConstants.DialogType.DIALOG_NEVER_ASK;
                    openAlertDialog(mRequsetSettings, mGoToSettings, mCancel, this, MyActivity.this);
            super.onRequestPermissionsResult(requestCode, permissions, grantResults);

//check for camera and storage access permissions
private void checkMultiplePermissions(int permissionCode, Context context) {

    if (!hasPermissions(context, PERMISSIONS)) {
        ActivityCompat.requestPermissions((Activity) context, PERMISSIONS, permissionCode);
    } else {
        // Open your camera here.

private boolean hasPermissions(Context context, String... permissions) {
    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && context != null && permissions != null) {
        for (String permission : permissions) {
            if (ActivityCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) {
                return false;
    return true;
            checkMultiplePermissions(REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS, MyActivity.this);
   } else {
            // Open your camera here.
public static void openAlertDialog(String message, String positiveBtnText, String negativeBtnText,
                            final OnDialogButtonClickListener listener,Context mContext) {

    AlertDialog.Builder builder = new AlertDialog.Builder(mContext, R.style.AlertDialogCustom);
    builder.setPositiveButton(positiveBtnText, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialogInterface, int i) {
    builder.setPositiveButton(positiveBtnText, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialogInterface, int i) {

public interface OnDialogButtonClickListener {

void onPositiveButtonClicked();

void onNegativeButtonClicked();
public void onPositiveButtonClicked() {
    switch (mDialogType) {
        case ValueConstants.DialogType.DIALOG_DENY:
            checkMultiplePermissions(REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS, MyActivity.this);
        case ValueConstants.DialogType.DIALOG_NEVER_ASK:


public void onNegativeButtonClicked() {


Requesting Manifest.permission.USE_SIP acts weird

By : Rachel Liu
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further So, I figured it out (at least the first part, the important part). I was requesting multiple permissions at a time and before requesting the USE_SIP one I was requesting and granting the REA_PHONE_STATE permission. They both are part of the large group of permissions PHONE. Apparently, and this is what I did not know, is that once a permission group item receives the OK from the user, then all of its items are fine.
Now ... I still can't figure out why the CONFIGURE_SIP permission is visible under Settings, but I've noticed that on 7.0.0 it's not being displayed ... so in case anyone wants to open a question on that, be my guest.
Related Posts Related Posts :
  • How to unit test retrofit call?
  • Retrieving Uid's from Firebase Database
  • How to automatically close rewarded video ad in onRewarded method
  • Check if two Location Instances are the same value?
  • How to get the base alphabet of a foreign word and sort them accordingly like in device local contact?
  • http2 doesn't seem to be working with OkHttp3 and retrofit2
  • Failed to resolve: com.google.android:flexbox:1.1.0
  • How to fix Xiaomi specific RemoteServiceException with notification icon?
  • Placing text in the center of a CircularProgressIndicator
  • Calculator that accepts floating point values
  • Bitrise error Could not find com.google.gms:google-services:3.2.1
  • Check if Input is empty doesnt work Kotlin
  • Could not find method compile() for arguments [com.google.gms:google-services:4.0.0]
  • View AGPS setting in Android
  • Am I doing dependency injection in activity code correctly?
  • React Native Gradle ImagePicker wont build
  • React Native changes to code have no affect on emulator app?
  • Get the TextView value of the gridview while clicking on an element
  • How to launch an intent for a third party app?
  • Going crazy trying to change android theme on Xamarin.Forms
  • Could not find any matches for com.android.tools.build:gradle:2.3.+ as no versions of com.android.tools.build:gradle are
  • How can I capture variables inside of Context
  • React Native : Could not find com.android.tools.build:gradle:2.2.3
  • Google Login/Signin on Yandex Android extension
  • Retrofit generates wrong GET request parameters from Map<String : Any>
  • Flutter app crashing when opening first time with ClassNotFoundException on Android
  • Android LinearLayout programmatically one column left, one column float right
  • Kotlin - convert UTC to local time
  • Android'd ForegroundDispatch for NFC
  • How to use Shared Preferences in class to set all activities?
  • Synchronous Volley request locks up
  • How do I inherit a function from another class into an activity in kotlin?
  • BottomAppBar Navigation Icon with Badge
  • Change content_main XML in Basic Navigation Drawer Template
  • HERE SDK Android: PositioningManager not working with NETWORK_PROVIDER in 3.8 or 3.9
  • No response after putting in Header in request
  • Where are default shared preferences written to?
  • how to show a part of next image in daimajia slider?
  • AlertDialog Builder inside holder.itemView.setOnClickListener onBindViewHolder
  • Flutter Grid view is not scrolling
  • How to access view in addTextChangedListener?
  • How do I link multiple activities in android navigation editor?
  • Failed to resolve: com.google.android.exoplayer:extension-mediasession:2.8.4
  • ViewPager + Picasso + multiple images from URL String array
  • how do I open another fragment after selecting the image in recycler view?
  • Send data from fragment to another fragment
  • Custom TitleView with Description and Preview Image Android TV (FireTV)
  • Gradle project sync failed. basic functionality (e.g. editing debugging) will not work properly
  • how to retrieve firebase storage images in release mode?
  • Android Studio: Could not find matches as no versions of com.android.tools.build:gradle are available
  • Getting a JSON Left side Value
  • Is it possible to use of Mobile data while transferring file via Wi-Fi Direct?
  • Build Error: Could not find any version that matches com.android.tools.build:transform-api:1.5.+
  • Robolectric 4.0.2 test are not running in gradle 3.2.1 with NoSuchMethodError: setUseLegacyResources(Z)V
  • How to be notified of another app's crash?
  • Could not find com.android.tools.build:gradle:2.2.3
  • Recyclerview scroll to empty Edit Text
  • How to set applicationID using Android.mk
  • Firebase: How to implement "take action only when another device is online"?
  • Can not find attribute app:useSimpleSummaryProvider
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org