Browse Source

Add READ_SMS and RECEIVE_SMS permissions

vspedr 7 years ago
parent
commit
3c27aeaf40
3 changed files with 8 additions and 2 deletions
  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 View File

12
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
12
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
13
     <uses-permission android:name="android.permission.READ_CONTACTS"/>
13
     <uses-permission android:name="android.permission.READ_CONTACTS"/>
14
     <uses-permission android:name="android.permission.READ_CALENDAR"/>
14
     <uses-permission android:name="android.permission.READ_CALENDAR"/>
15
-
15
+    <uses-permission android:name="android.permission.READ_SMS"/>
16
+    <uses-permission android:name="android.permission.RECEIVE_SMS"/>
16
 
17
 
17
     <application
18
     <application
18
       android:name=".MainApplication"
19
       android:name=".MainApplication"

+ 3
- 0
README.md View File

13
 - Push Notifications *(iOS only)*
13
 - Push Notifications *(iOS only)*
14
 - Background Refresh *(iOS only)*
14
 - Background Refresh *(iOS only)*
15
 - Speech Recognition *(iOS only)*
15
 - Speech Recognition *(iOS only)*
16
+- Read/Receive SMS *(Android only)*
16
 
17
 
17
 
18
 
18
 | Version | React Native Support |
19
 | Version | React Native Support |
120
 |`backgroundRefresh`| ✔️ | ❌ |
121
 |`backgroundRefresh`| ✔️ | ❌ |
121
 |`speechRecognition`| ✔️ | ❌ |
122
 |`speechRecognition`| ✔️ | ❌ |
122
 |`storage`| ❌️ | ✔ |
123
 |`storage`| ❌️ | ✔ |
124
+|`readSms`| ❌️ | ✔ |
125
+|`receiveSms`| ❌️ | ✔ |
123
 
126
 
124
 ### Methods
127
 ### Methods
125
 | Method Name | Arguments | Notes
128
 | Method Name | Arguments | Notes

+ 3
- 1
index.android.js View File

12
 	event: RNPermissions.PERMISSIONS.READ_CALENDAR,
12
 	event: RNPermissions.PERMISSIONS.READ_CALENDAR,
13
 	storage: RNPermissions.PERMISSIONS.READ_EXTERNAL_STORAGE,
13
 	storage: RNPermissions.PERMISSIONS.READ_EXTERNAL_STORAGE,
14
 	photo: RNPermissions.PERMISSIONS.READ_EXTERNAL_STORAGE,
14
 	photo: RNPermissions.PERMISSIONS.READ_EXTERNAL_STORAGE,
15
+	readSms: RNPermissions.PERMISSIONS.READ_SMS,
16
+	receiveSms: RNPermissions.PERMISSIONS.READ_SMS,
15
 }
17
 }
16
 
18
 
17
 const RESULTS = {
19
 const RESULTS = {
41
 	check(permission) {
43
 	check(permission) {
42
 		const androidPermission = RNPTypes[permission]
44
 		const androidPermission = RNPTypes[permission]
43
   	if (!androidPermission) return Promise.reject(`ReactNativePermissions: ${permission} is not a valid permission type on Android`);
45
   	if (!androidPermission) return Promise.reject(`ReactNativePermissions: ${permission} is not a valid permission type on Android`);
44
-		
46
+
45
 		const shouldShowRationale = ReactNative.NativeModules.PermissionsAndroid.shouldShowRequestPermissionRationale;
47
 		const shouldShowRationale = ReactNative.NativeModules.PermissionsAndroid.shouldShowRequestPermissionRationale;
46
 
48
 
47
 		return RNPermissions.check(androidPermission)
49
 		return RNPermissions.check(androidPermission)