Quellcode durchsuchen

Add READ_SMS and RECEIVE_SMS permissions

vspedr vor 8 Jahren
Ursprung
Commit
3c27aeaf40
3 geänderte Dateien mit 8 neuen und 2 gelöschten Zeilen
  1. 2 1
      Example/android/app/src/main/AndroidManifest.xml
  2. 3 0
      README.md
  3. 3 1
      index.android.js

+ 2 - 1
Example/android/app/src/main/AndroidManifest.xml

@@ -12,7 +12,8 @@
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
     <uses-permission android:name="android.permission.READ_CONTACTS"/>
     <uses-permission android:name="android.permission.READ_CALENDAR"/>
-
+    <uses-permission android:name="android.permission.READ_SMS"/>
+    <uses-permission android:name="android.permission.RECEIVE_SMS"/>
 
     <application
       android:name=".MainApplication"

+ 3 - 0
README.md

@@ -13,6 +13,7 @@ The current supported permissions are:
 - Push Notifications *(iOS only)*
 - Background Refresh *(iOS only)*
 - Speech Recognition *(iOS only)*
+- Read/Receive SMS *(Android only)*
 
 
 | Version | React Native Support |
@@ -120,6 +121,8 @@ Promises resolve into one of these statuses
 |`backgroundRefresh`| ✔️ | ❌ |
 |`speechRecognition`| ✔️ | ❌ |
 |`storage`| ❌️ | ✔ |
+|`readSms`| ❌️ | ✔ |
+|`receiveSms`| ❌️ | ✔ |
 
 ### Methods
 | Method Name | Arguments | Notes

+ 3 - 1
index.android.js

@@ -12,6 +12,8 @@ const RNPTypes = {
 	event: RNPermissions.PERMISSIONS.READ_CALENDAR,
 	storage: RNPermissions.PERMISSIONS.READ_EXTERNAL_STORAGE,
 	photo: RNPermissions.PERMISSIONS.READ_EXTERNAL_STORAGE,
+	readSms: RNPermissions.PERMISSIONS.READ_SMS,
+	receiveSms: RNPermissions.PERMISSIONS.READ_SMS,
 }
 
 const RESULTS = {
@@ -41,7 +43,7 @@ class ReactNativePermissions {
 	check(permission) {
 		const androidPermission = RNPTypes[permission]
   	if (!androidPermission) return Promise.reject(`ReactNativePermissions: ${permission} is not a valid permission type on Android`);
-		
+
 		const shouldShowRationale = ReactNative.NativeModules.PermissionsAndroid.shouldShowRequestPermissionRationale;
 
 		return RNPermissions.check(androidPermission)