Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/0x1bitcrack3r/rn-android-overlay-permission
Overlay permission for android-react-native apps
https://github.com/0x1bitcrack3r/rn-android-overlay-permission
android android-application hacktoberfest native-module npm npm-package overlay-permission permissions react react-native
Last synced: 2 months ago
JSON representation
Overlay permission for android-react-native apps
- Host: GitHub
- URL: https://github.com/0x1bitcrack3r/rn-android-overlay-permission
- Owner: 0x1bitcrack3r
- License: mit
- Created: 2020-09-19T07:15:57.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-10-11T18:15:46.000Z (about 1 year ago)
- Last Synced: 2024-10-02T03:01:48.775Z (3 months ago)
- Topics: android, android-application, hacktoberfest, native-module, npm, npm-package, overlay-permission, permissions, react, react-native
- Language: Java
- Homepage: https://www.npmjs.com/package/rn-android-overlay-permission
- Size: 15.6 KB
- Stars: 12
- Watchers: 2
- Forks: 15
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[0x1bitcrack3r](https://0x1bitcrack3r.me)
# rn-android-overlay-permission
This module is to request screen overlay permission from user in react-native based android application
## Getting started
`$ npm install rn-android-overlay-permission --save`
### Mostly automatic installation
`$ react-native link rn-android-overlay-permission`
### Add these permissions in AndroidManifest.xml
```javascript
```
### Manual installation
#### Android
1. Open up `android/app/src/main/java/[...]/MainActivity.java`
- Add `import com.overlaypermission.OverlayPermissionPackage;` to the imports at the top of the file
2. Append the following lines to `android/settings.gradle`:
```
include ':rn-android-overlay-permission'
project(':rn-android-overlay-permission').projectDir = new File(rootProject.projectDir, '../node_modules/rn-android-overlay-permission/android')
```3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
```
compile project(':rn-android-overlay-permission')
```## Usage
```javascript
//requestOverlayPermission Navigates to permission settings
OverlayPermissionModule.requestOverlayPermission();
``````javascript
import OverlayPermissionModule from "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 }
);
}
});
}
```