Android support #87
Comments
+1 |
+1,001 |
Hey guys, I'm working with a few folks from @exponentjs on the next iteration of rem which will support Android builds. Currently I'm not using rem but I think it is a good thing for the community going forward, so I'm investing some time in helping with that effort. FB currently doesn't have a recommended approach to Android module development - we're trying to solve that. Ideally this will allow you to install your modules like |
@lwansbrough: do you accept donations? Glad you're championing the "camera space" of React Native |
@Achang28 Thanks for considering donating! However I'm not doing this for the money, I've gone a personal interest in keeping the development of this up to date. Always looking for contributors though -- I think more of the community modules could use a larger backing of contributors to keep them fresh. |
Small update: moved the iOS files around in preparation for Android dev. 👍 |
Thank you very much @lwansbrough ! 👍 |
Thanks a lor! I Will wait For Android Version! |
https://www.npmjs.com/search?q=react-native-camera version is 0.3.3 . How can I use the lastest version in my project? |
😬 Oops forgot to publish! Try now. |
I gave it a shot and got the camera view working on android: https://github.com/timmh/react-native-camera |
@timmh Nice work, this is definitely something we can build on. I will mention that if it's anything like Obj-C, you will need to inherit React's view class so that you get all their view stuff like flexbox, etc. |
I think the whole style & layout works via |
hi, @timmh how can i use your android version? |
@tlightsky there is an README.md in the android directory that has instructions how to use it. |
@timmh I am also interested in it! Hoping that you Will merge! |
We need a way of depending on 3rd party libs first. Currently we have to include the binary that we're targeting which sucks. |
With that said, since I don't think Android has bar code scanning by default (correct my if I'm wrong) then yes I'd be interested in using zxing. Historically it has been the position of this library to not depend on third party libraries but that may need to be the case for Android feature parity. What I really want is a build script that links to a Maven repo though. But we need to standardize something like that across React Native before doing it here. |
You are right, unfortunately android does not have barcode scanning included. |
@timmh thanks for your work! i pulled and tried to get it to work, but I ran into issues here:
(maybe it would also be worth mentioning that the lines for build.gradle are meant to be added in the android/app/build.gradle, not android/build.gradle, I got confused with that until I figured it out.) second, after I got everything to compile, and I start the app, it instantely crashes with this error:
any idea why this might happen/how to fix it? again, thanks for your work! |
ah btw, the crash happens after adding this line:
to the MainActivity.java |
Hey @JorisM, thanks for your feedback! |
ah yes, that was it! thanks a bunch for reporting back so quickly! yup I agree about not spamming this thread, but I couldn't create an issue on your fork since issues don't seem to be enabled. |
in @timmh's version, I get the following error when I do
When I investigate the Camera component in the debugger, the |
@JorisM You are right, I did not notice that issues were disabled. Happy that you now seem to have it working. Issues are now enabled for my fork so if anyone has questions / issues regarding that, please fill an issue there. |
I can run the camera on Andorid with @timmh 's version. |
@lwansbrough Is there an ETA on this? |
I assume you've all spotted this? https://github.com/NorthFoxz/react-native-camera-android Any thoughts? |
I just opened an issue to ask if @northfoxz wants to merge the modules. Hopefully he's interested! :) Nice find @jhogendorn |
@lwansbrough @northfoxz @jhogendorn @timmh It looks like there are a few threads going on independently right now. Here is my current understanding of the situation: react-native-camera-android has barcode support & disk support I do not care which base implementation we go with, but I would like to standardize functionality and get this merged back asap. For now I will file some PR's against timmh's fork. Reconciling should be simple with all necessary code pretty much going in the onPictureTaken handler: Thoughts? |
@rt2zz Of course, I forgot about @timmh's fork! Ideally we go with the more stable solution. I don't have any preference over what get's implemented. Standardization is a must. If certain branches are handling things better than others, lets take the best of each where possible. APIs need to be consistent with iOS. If this is an impossibility lets talk about what needs to be changed so we can standardize them. Is anyone willing to oversee this merging process? I'm happy to help whenever possible, but we kind of need an owner for the Android side of it. |
ideally someone with more android experience than myself, but I am happy to reconcile as needed. |
@rt2zz As am I when I have the time. Looking for input from @timmh and @northfoxz regarding how they think it should be done. I suppose we need to start by looking at which implementation is further along or more stable. Closer feature parity is probably more important than stability at this point, as long as the approach is correct. We should also discuss any necessary/ideal API changes that should happen when we merge this. Do we want to keep callbacks, for example, or do we want to switch to events? |
There are several issues left in my implementation now:
I have to fix these issues before merging to iOS support. |
Sounds good. I like callbacks. I forgot about video. Reaching feature parity may take a while but afaik everything is possible (namely passive barcode scan and touch to focus) |
@northfoxz fyi we are getting decent progress over at timmh#19 Your project has barcode which is a huge +, it might be good to coordinate efforts moving forward. What do you think? |
@rt2zz sure i would love to help! |
@northfoxz Sounds good - you should send those PRs to @timmh's fork so we don't have to coordinate the merge of Android stuff here. Hopefully that will make bringing Android over as a whole easier. |
Looking forward to android support being merged! |
Same here, can't wait! Thanks for all the great work on this everybody. |
I pushed a PR (#157) from my fork a couple of days ago and forgot to mention it here. I haven't touched java for years and I am definitively not an Android expert so at the very least I expect my code to not be very idiomatic and I might have done some mistakes that should be pretty obvious to spot for a more seasoned Android developer. So far only capturing stills has been implemented, adding video should not be too difficult but I hadn't time yet to look into it. I haven't yet looked much into bar code scanning but that might help http://android-developers.blogspot.com/2015/08/barcode-detection-in-google-play.html. A few other smaller things are in my todo list such as taking in account the orientation props and fixing the improper saved image orientation when using the front camera. It has only been tested on a nexus 5 and with the genymotion emulator because of its easy camera support and I am looking forward to see how it will behave on other devices. |
I also realize I might have duplicated effort. I have been working on it over the last couple of weeks and didn't realize some were doing the same. Well, I guess there are now 3 different implementation to consider/cherry pick. |
haha @farmisen yeah no worries. I think you might actually have the highest api coverage of any of the forks. I think whoever implements video first will take the cake though. |
@farmisen nice job! i think i wont have the time necessary to finish the api merge, please continue your work and i will help if theres time |
Could Android support be without Video until it's ready? Or would that cause too many issues? |
no hard promise but looking to the android dev doc it does not look like too difficult to implement so I am going to give it a shot today. |
#157 has been merged. All efforts for Android should be directed towards the merged implementation. For those of you with forks, please take a look at what missing and help implement those features if you already have them developed. Thanks so much guys. Tons of great work here. |
@lwansbrough Is the barcode issue is also sorted out? |
@rohitgoyal no. There are two possibilities: either using zxing barcode scanner or using android native barcode scanner. The downside of the latter is that it lacks support for older versions of android. If you have some time, there is a working android barcode implementation at https://github.com/NorthFoxz/react-native-camera-android that can be used as a reference for implementing here. PR appreciated! |
Thanks for the great work =) Currently android version does not support video recording, is there any plan for implementing video feature for android too @lwansbrough @farmisen? |
My initial stab at video for android can be found here: I feel I have tried anything, but cannot get a playable video file (there is data in there for sure, it just doesn't play, not on android, not in VLC) This might be due to my device(s), the Samsung Galaxy S4 Mini, and a Nexus 7. I commented a lot of the code to hopefully get other people going on trying it out / play with it / report back with findings / results. To try out my branch, run: npm install --save git+https://github.com/vespakoen/react-native-camera.git#master Helpful links: http://developer.android.com/guide/topics/media/camera.html#capture-video |
Some more testing options... here is my pull request for code I've been working on for awhile to support recording video on Android:
Goal is "drop in" for compatibility with IOS... to make Android and IOS equivalent. I will continue to enhance this as bugs or additional changes are needed since I need this for my own project. Please send me you feedback, thanks. To install latest version, run:
|
As for installation (I might not have understood some of what was going on above) it's worth mentioning the |
The feature is officially merged and now part of the repo: You can close this. |
Hey guys, fantastic job! Thank you!
I was just wondering whether you have plans to add Android support as well.
The text was updated successfully, but these errors were encountered: