Socket
Book a DemoInstallSign in
Socket

videosdk-rn-android-overlay-permission

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

videosdk-rn-android-overlay-permission

Overlay Permission for Android apps

latest
Source
npmnpm
Version
1.0.6
Version published
Maintainers
1
Created
Source

videosdk-rn-android-overlay-permission

This module is to request screen overlay permission from user in react-native based android application.

Getting started

$ npm install videosdk-rn-android-overlay-permission --save

Mostly automatic installation

$ react-native link videosdk-rn-android-overlay-permission

Add these permissions in AndroidManifest.xml

<uses-permission android:name="android.permission.ACTION_MANAGE_OVERLAY_PERMISSION" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />

Manual installation

Android

  • Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.overlaypermission.OverlayPermissionPackage; to the imports at the top of the file
  • Append the following lines to android/settings.gradle:

        include ':videosdk-rn-android-overlay-permission'
        project(':videosdk-rn-android-overlay-permission').projectDir = new File(rootProject.projectDir, '../node_modules/videosdk-rn-android-overlay-permission/android')
    
  • Insert the following lines inside the dependencies block in android/app/build.gradle:

        compile project(':videosdk-rn-android-overlay-permission')
    

Usage

//requestOverlayPermission Navigates to permission settings
OverlayPermissionModule.requestOverlayPermission();
import OverlayPermissionModule from "videosdk-rn-android-overlay-permission";

if (Platform.OS === "android") {
  OverlayPermissionModule.isRequestOverlayPermissionGranted((status: any) => {
    if (status) {
      Alert.alert(
        "Permissions",
        "Overlay Permission",
        [
          {
            text: "Cancel",
            onPress: () => console.log("Cancel Pressed"),
            style: "cancel",
          },
          {
            text: "OK",
            onPress: () => OverlayPermissionModule.requestOverlayPermission(),
          },
        ],
        { cancelable: false }
      );
    }
  });
}

Keywords

Android

FAQs

Package last updated on 26 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts