react-native-callkeep icon indicating copy to clipboard operation
react-native-callkeep copied to clipboard

Getting default enabled permission on Xiaomi models

Open aghahuseynov opened this issue 4 years ago • 4 comments

Ekran Resmi 2021-03-30 10 20 59 # Bug report

  • [ ] I've checked the example to reproduce the issue.

  • Reproduced on:

  • [ ] Android

Description

How I can reach the permission ?, I can't find. When this permission is not activated on some xiaomi devices, the application does not stand up. How can we make this default active?

Steps to Reproduce

Versions

- Callkeep latest:
- React Native latest:
- Phone model  Xiaomi  8 Lite or Redmi 9 Pro , Redmi 8 Pro: 

Logs

Paste here

aghahuseynov avatar Mar 30 '21 07:03 aghahuseynov

Hello unfortunately this is not an issue with this plugin. Miui does not yet offer any way to request these permissions.

mozhn avatar Apr 20 '21 21:04 mozhn

Hi team Any solution for this?

ashirkhan94 avatar Jun 27 '24 09:06 ashirkhan94

Unfortunately, it's not possible to request these permissions by default on MIUI. However, you can manually guide the user to the relevant permission settings.

import IntentLauncher from 'react-native-intent-launcher';
import { Alert} from "react-native";

const isMiuiDevice = async () => {
    const manufacturer = await DeviceInfo.getManufacturer();
    return manufacturer === "Xiaomi"
}

 const requestMiuiPermissions = async () => {

        const isMiui = await isMiuiDevice();

        if (isMiui) {
            Alert.alert(
               "Extra Permission Required",
                "This device is based on MIUI. You need to manually enable the following permissions:\n\n• Show on lock screen\n• Open windows in the background\n• Display pop-up windows"",
                [
                    {
                        text: "Open Settings",
                        onPress: () => {
                            try {
                                IntentLauncher.startActivity({
                                    action: 'miui.intent.action.APP_PERM_EDITOR',
                                    packageName: 'com.miui.securitycenter',
                                    className: 'com.miui.permcenter.permissions.PermissionsEditorActivity',
                                    extra: {
                                        'extra_pkgname': 'com.your.app.id',
                                    },
                                });
                            } catch (e) {
                                Linking.openSettings();
                            }
                        },
                    },
                    { text: "Cancel", style: 'cancel' },
                ]
            );
        }
    };

oztasyasin avatar Apr 14 '25 14:04 oztasyasin

How to check Permission is Granted or not?

sammi06 avatar Nov 28 '25 12:11 sammi06