- Updated Read Me with correct Android install information.

- Fixed promise error during android deployment
This commit is contained in:
Lochlan Wansbrough 2016-01-31 20:56:38 -08:00
parent edf0736f92
commit f5ab0c8432
2 changed files with 5 additions and 5 deletions

View File

@ -27,7 +27,7 @@ Below is a list of known issues. Pull requests are welcome for any of these issu
#### Android
1. `npm install react-native-camera@latest --save`
2. Open up `android/app/main/java/[...]/MainActivity.java
- Add `import com.lwansbrough.RCTCameraPackage;` to the imports at the top of the file
- Add `import com.lwansbrough.RCTCamera.*;` to the imports at the top of the file
- Add `new RCTCameraPackage()` to the list returned by the `getPackages()` method
3. Append the following lines to `android/settings.gradle`:

View File

@ -197,7 +197,7 @@ public class RCTCameraModule extends ReactContextBaseJavaModule {
File tempFile = getTempMediaFile(MEDIA_TYPE_IMAGE);
if (tempFile == null) {
callback.invoke("Error creating media file.", null);
promise.reject("Error creating media file.");
return;
}
@ -206,11 +206,11 @@ public class RCTCameraModule extends ReactContextBaseJavaModule {
fos.write(data);
fos.close();
} catch (FileNotFoundException e) {
callback.invoke("File not found: " + e.getMessage(), null);
promise.reject("File not found: " + e.getMessage());
} catch (IOException e) {
callback.invoke("Error accessing file: " + e.getMessage(), null);
promise.reject("Error accessing file: " + e.getMessage());
}
callback.invoke(null, Uri.fromFile(tempFile).toString());
promise.resolve(Uri.fromFile(tempFile).toString());
break;
}
}