shaithana / cordova-plugin-wezka-nativecamera Goto Github PK
View Code? Open in Web Editor NEWAn android cordova native camera based on custom activity.
An android cordova native camera based on custom activity.
getSize is not supported in 2.3
E/AndroidRuntime( 2282): java.lang.NoSuchMethodError: android.view.Display.getSize
E/AndroidRuntime( 2282): at com.wezka.nativecamera.CameraActivity.onCreate(CameraActivity.java:130)
E/AndroidRuntime( 2282): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime( 2282): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
E/AndroidRuntime( 2282): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
I've noticed someone asking for support for iOS http://community.phonegap.com/nitobi/topics/this-plugin-org-wbt11a-nativecamera-will-cause-only-ios-build-failure
I've also seen someone forking your repo and adding support for iOS and WP8. It currently has 20 commits ahead and 25 commits behind. It could be interesting to try to merge both repos: https://github.com/wbt11a/cordova-plugin-wezka-nativecamera
Thanks.
Manufacturer: SWIPE
Model: Elite Power
Board: Msm8909
Android API: 23
Android OS: 6.0.1
Brand: Swipe
RAM: 1.87GB
Orientation: Portrait
Exception java.lang.NullPointerException: Attempt to invoke virtual method 'void android.hardware.Camera.release()' on a null object reference
com.tmantman.nativecamera.CameraActivity.restartPreview (CameraActivity.java:351)
com.tmantman.nativecamera.CameraActivity$2.onClick (CameraActivity.java:213)
android.view.View.performClick (View.java:5211)
android.view.View$PerformClick.run (View.java:21170)
android.os.Handler.handleCallback (Handler.java:739)
android.os.Handler.dispatchMessage (Handler.java:95)
android.os.Looper.loop (Looper.java:148)
android.app.ActivityThread.main (ActivityThread.java:5417)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:726)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:616)
I can't reproduce this one, but the preview image displayed freezes sometimes. Locking phone and re-opening does not work, but switching cameras does.
Even using destinationType: destinationType.DATA_URL the callback function is returning FILE_URI.
when I use PGB 3.5 (build.phonegap.com)
it will cause "only ios" build failure
Apparently surfaceView operations should be done in onResume, not onCreate:
http://stackoverflow.com/questions/4852740/surfaceview-getholder-not-returning-surfaceholder
"STACK_TRACE": "java.lang.NullPointerException\n\tat com.wezka.nativecamera.CameraActivity.initPreview(CameraActivity.java:372)\n\tat com.wezka.nativecamera.CameraActivity.access$1300(CameraActivity.java:55)\n\tat com.wezka.nativecamera.CameraActivity$6.surfaceChanged(CameraActivity.java:420)\n\tat android.view.SurfaceView.updateWindow(SurfaceView.java:545)\
A portrait image ends up looking landscape. Degrees is correctly returning 90 when vertical.
Just writing to ask whether or not the DATA_URL destination type is supported in this new plugin?
Right now, the flash turns on permanently until the picture is taken when in flash mode. Is this the desired behavior?
java.lang.NullPointerException
E/AndroidRuntime(13415): at com.wezka.nativecamera.CameraActivity$6.surfaceChanged(CameraActivity.java:412)
camera.setDisplayOrientation(90);
First time I start my camera I can't capture the photo. But if I lock / unlock my screen then try it works.
Even if i flip to front camera and try it works.
Any hints on how to fix this?
Android version : 4.4.4
I'm not sure if this is something from my own project being incorrect or a problem with the plug-in but I'd appreciate help in debugging this. When attempting to use the getPicture function the app crashes with this message in log cat
E/AndroidRuntime( 7280): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.text2drive.ethereal.dev/com.wezka.nativecamera.CameraActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x0
E/AndroidRuntime( 7280): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2198)
E/AndroidRuntime( 7280): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2257)
E/AndroidRuntime( 7280): at android.app.ActivityThread.access$800(ActivityThread.java:139)
E/AndroidRuntime( 7280): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
E/AndroidRuntime( 7280): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 7280): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 7280): at android.app.ActivityThread.main(ActivityThread.java:5086)
E/AndroidRuntime( 7280): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 7280): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 7280): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
E/AndroidRuntime( 7280): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
E/AndroidRuntime( 7280): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 7280): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
E/AndroidRuntime( 7280): at android.content.res.Resources.getValue(Resources.java:1123)
E/AndroidRuntime( 7280): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2312)
E/AndroidRuntime( 7280): at android.content.res.Resources.getLayout(Resources.java:939)
E/AndroidRuntime( 7280): at android.view.LayoutInflater.inflate(LayoutInflater.java:395)
E/AndroidRuntime( 7280): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
E/AndroidRuntime( 7280): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
E/AndroidRuntime( 7280): at android.app.Activity.setContentView(Activity.java:1937)
E/AndroidRuntime( 7280): at com.wezka.nativecamera.CameraActivity.onCreate(CameraActivity.java:91)
E/AndroidRuntime( 7280): at android.app.Activity.performCreate(Activity.java:5248)
E/AndroidRuntime( 7280): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
E/AndroidRuntime( 7280): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2162)
it seems like a resource id isn't be set so that when trying to find the activity for the camera it is unable to. I'm not sure if there's an installation step I'm missing or perhaps a file that is not being correctly generated.
java.lang.NullPointerException
at com.wezka.nativecamera.CameraActivity.initPreview(CameraActivity.java:410)
at com.wezka.nativecamera.CameraActivity.access$1300(CameraActivity.java:57)
It is continually autofocusing, which is good. However, if the user taps the shutter button, it will immediately take a blurry picture without trying to focus first.
hi,
Firstly thanks a ton for the useful plugin. Can I have a simple / sample code on how to use this plugin? I am totally new to android / java development and learning to add plugins. I am using a Mobile Backend Service for creating my app and it already has the default camera plugin installed. So I just want to make sure that I am starting right
thanks,
M&M
Trying to build with crosswalk + ionic framework. Getting build error -
:compileDebugJava/Users/nakumar/Desktop/DwellMartServer/dwellmartoperationsapp/platforms/android/src/com/wezka/nativecameraplugin/NativeCameraLauncher.java:29: error: cannot find symbol
import org.apache.cordova.ExifHelper;
^
symbol: class ExifHelper
location: package org.apache.cordova
/Users/nakumar/Desktop/DwellMartServer/dwellmartoperationsapp/platforms/android/src/com/wezka/nativecameraplugin/NativeCameraLauncher.java:149: error: cannot find symbol
rotate = exif.getOrientation();
^
symbol: method getOrientation()
location: variable exif of type ExifHelper
/Users/nakumar/Desktop/DwellMartServer/dwellmartoperationsapp/platforms/android/src/com/wezka/nativecameraplugin/NativeCameraLauncher.java:251: error: cannot find symbol
exif.resetOrientation();
^
symbol: method resetOrientation()
location: variable exif of type ExifHelper
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
3 errors
FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':compileDebugJava'.
Compilation failed; see the compiler error output for details.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 12.508 secs
/Users/nakumar/Desktop/DwellMartServer/dwellmartoperationsapp/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /Users/nakumar/Desktop/DwellMartServer/dwellmartoperationsapp/platforms/android/gradlew with args: assembleDebug,-b,/Users/nakumar/Desktop/DwellMartServer/dwellmartoperationsapp/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR running one or more of the platforms: Error: /Users/nakumar/Desktop/DwellMartServer/dwellmartoperationsapp/platforms/android/cordova/run: Command failed with exit code 8
You may not have the required environment or OS to run this project
hi, how to turn zoom of camera in this plugin
W/System.err( 6830): java.io.FileNotFoundException: No such file or directory
W/System.err( 6830): at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:146)
W/System.err( 6830): at android.content.ContentProviderProxy.openAssetFile(ContentProviderNative.java:611)
W/System.err( 6830): at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:922)
W/System.err( 6830): at android.content.ContentResolver.openOutputStream(ContentResolver.java:669)
W/System.err( 6830): at android.content.ContentResolver.openOutputStream(ContentResolver.java:645)
W/System.err( 6830): at com.wezka.nativecamera.NativeCameraLauncher.onActivityResult(NativeCameraLauncher.java:179)
W/System.err( 6830): at org.apache.cordova.CordovaActivity.onActivityResult(CordovaActivity.java:897)
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=null} to activity {co.mwater.clientapp/co.mwater.clientapp.mWater}: java.lang.NullPointerException
at android.app.ActivityThread.deliverResults(ActivityThread.java:3525)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3568)
at android.app.ActivityThread.access$1100(ActivityThread.java:162)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1412)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5371)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)\nCaused by: java.lang.NullPointerException
at co.mwater.foregroundcameraplugin.ForegroundCameraLauncher.scaleBitmap(ForegroundCameraLauncher.java:271)
at co.mwater.foregroundcameraplugin.ForegroundCameraLauncher.onActivityResult(ForegroundCameraLauncher.java:198)
at org.apache.cordova.CordovaActivity.onActivityResult(CordovaActivity.java:897)
at android.app.Activity.dispatchActivityResult(Activity.java:5311)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3521)
... 11 more\njava.lang.NullPointerException
at co.mwater.foregroundcameraplugin.ForegroundCameraLauncher.scaleBitmap(ForegroundCameraLauncher.java:271)
at co.mwater.foregroundcameraplugin.ForegroundCameraLauncher.onActivityResult(ForegroundCameraLauncher.java:198)
at org.apache.cordova.CordovaActivity.onActivityResult(CordovaActivity.java:897)
at android.app.Activity.dispatchActivityResult(Activity.java:5311)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3521)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3568)
at android.app.ActivityThread.access$1100(ActivityThread.java:162)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1412)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5371)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
Hey,
Just writing to see if this new plugin can be submitted to phonegap build. While I do not intend to use this right away (I'd rather let this project mature some more), it will be helpful for when it's ready for production use.
Thanks,
David
Once camera flash is on, it not became off anymore.
I need to turn off my device to turn off flash.
Device : CANVAS UNITE 2 (A106)
Android Version : 4.4
java.lang.RuntimeException: Unable to resume activity {com.myapp.android/com.wezka.nativecamera.CameraActivity}: java.lang.RuntimeException: Fail to connect to camera service at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2964) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2993) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395) at android.app.ActivityThread.access$800(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321) at android.os.Handler.dispatchMessage(Handler.java:110) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:5292) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.RuntimeException: Fail to connect to camera service at android.hardware.Camera.native_setup(Native Method) at android.hardware.Camera.<init>(Camera.java:469) at android.hardware.Camera.open(Camera.java:424) at com.wezka.nativecamera.CameraActivity.onResume(CameraActivity.java:331) at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1197) at android.app.Activity.performResume(Activity.java:5343) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2950) ... 12 more
It looks like the plugin works well, I'll still have to test on other phone that usually crash when using the original plugin.
The only problem is that we also need support for picking images from the gallery, and with this plugin it just starts the camera. Is there any easy way to have the gallery back?
I saw the same request on another fork of the camera plugin: mWater/cordova-plugin-camera-foreground#9
Thanks.
How to actually use it?
i installed it in my angular cordova project, and I am using $ngCordova which uses Camera. But the problem still persists. Actually I think the problem now is even worse, every time I open camera my app closes due to inactivity. Do I need to do anything special to make it work?
Thanks
Hi Team,
While capturing the image , the image is not displaying in the VIEW, I have the following Logcat
Please refer and let me know for more information.
10-07 07:04:42.010 5918 5918 W ExifInterface: Invalid image.
10-07 07:04:42.010 5918 5918 W ExifInterface: java.io.EOFException
10-07 07:04:42.010 5918 5918 W ExifInterface: at java.io.DataInputStream.readByte(DataInputStream.java:77)
10-07 07:04:42.010 5918 5918 W ExifInterface: at android.media.ExifInterface.getJpegAttributes(ExifInterface.java:1599)
10-07 07:04:42.010 5918 5918 W ExifInterface: at android.media.ExifInterface.loadAttributes(ExifInterface.java:1339)
10-07 07:04:42.010 5918 5918 W ExifInterface: at android.media.ExifInterface.(ExifInterface.java:1057)
10-07 07:04:42.010 5918 5918 W ExifInterface: at com.wezka.nativecamera.ExifHelper.createOutFile(ExifHelper.java:83)
10-07 07:04:42.010 5918 5918 W ExifInterface: at com.wezka.nativecamera.NativeCameraLauncher.onActivityResult(NativeCameraLauncher.java:435)
10-07 07:04:42.010 5918 5918 W ExifInterface: at org.apache.cordova.CordovaInterfaceImpl.onActivityResult(CordovaInterfaceImpl.java:120)
10-07 07:04:42.010 5918 5918 W ExifInterface: at org.apache.cordova.CordovaActivity.onActivityResult(CordovaActivity.java:320)
10-07 07:04:42.010 5918 5918 W ExifInterface: at android.app.Activity.dispatchActivityResult(Activity.java:7137)
10-07 07:04:42.010 5918 5918 W ExifInterface: at android.app.ActivityThread.deliverResults(ActivityThread.java:4916)
10-07 07:04:42.010 5918 5918 W ExifInterface: at android.app.ActivityThread.handleSendResult(ActivityThread.java:4963)
10-07 07:04:42.010 5918 5918 W ExifInterface: at android.app.ActivityThread.access$1600(ActivityThread.java:221)
10-07 07:04:42.010 5918 5918 W ExifInterface: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1848)
10-07 07:04:42.010 5918 5918 W ExifInterface: at android.os.Handler.dispatchMessage(Handler.java:102)
10-07 07:04:42.010 5918 5918 W ExifInterface: at android.os.Looper.loop(Looper.java:158)
10-07 07:04:42.010 5918 5918 W ExifInterface: at android.app.ActivityThread.main(ActivityThread.java:7224)
10-07 07:04:42.010 5918 5918 W ExifInterface: at java.lang.reflect.Method.invoke(Native Method)
10-07 07:04:42.010 5918 5918 W ExifInterface: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
10-07 07:04:42.010 5918 5918 W ExifInterface: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
10-07 07:04:42.010 5918 5918 I NativeCameraLauncher: Bitmap not compressed
10-07 07:04:42.010 5918 5918 W System.err: java.io.EOFException
10-07 07:04:42.010 5918 5918 W System.err: at java.io.DataInputStream.readByte(DataInputStream.java:77)
10-07 07:04:42.010 5918 5918 W System.err: at android.media.ExifInterface.saveJpegAttributes(ExifInterface.java:1730)
10-07 07:04:42.010 5918 5918 W System.err: at android.media.ExifInterface.saveAttributes(ExifInterface.java:1388)
10-07 07:04:42.010 5918 5918 W System.err: at com.wezka.nativecamera.ExifHelper.writeExifData(ExifHelper.java:180)
10-07 07:04:42.010 5918 5918 W System.err: at com.wezka.nativecamera.NativeCameraLauncher.onActivityResult(NativeCameraLauncher.java:436)
10-07 07:04:42.010 5918 5918 W System.err: at org.apache.cordova.CordovaInterfaceImpl.onActivityResult(CordovaInterfaceImpl.java:120)
10-07 07:04:42.010 5918 5918 W System.err: at org.apache.cordova.CordovaActivity.onActivityResult(CordovaActivity.java:320)
10-07 07:04:42.010 5918 5918 W System.err: at android.app.Activity.dispatchActivityResult(Activity.java:7137)
10-07 07:04:42.010 5918 5918 W System.err: at android.app.ActivityThread.deliverResults(ActivityThread.java:4916)
10-07 07:04:42.010 5918 5918 W System.err: at android.app.ActivityThread.handleSendResult(ActivityThread.java:4963)
10-07 07:04:42.010 5918 5918 W System.err: at android.app.ActivityThread.access$1600(ActivityThread.java:221)
10-07 07:04:42.010 5918 5918 W System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1848)
10-07 07:04:42.010 5918 5918 W System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
10-07 07:04:42.010 5918 5918 W System.err: at android.os.Looper.loop(Looper.java:158)
10-07 07:04:42.010 5918 5918 W System.err: at android.app.ActivityThread.main(ActivityThread.java:7224)
10-07 07:04:42.010 5918 5918 W System.err: at java.lang.reflect.Method.invoke(Native Method)
10-07 07:04:42.010 5918 5918 W System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
10-07 07:04:42.010 5918 5918 W System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
10-07 07:04:42.010 5918 5918 I NativeCameraLauncher: failPicture:Error compressing image
Make it red to make it more obvious?
It should unregister or it will kill the battery (and slow the app)
java.lang.NullPointerException
at com.wezka.nativecamera.CameraActivity$1.onTouch(CameraActivity.java:152)
java.lang.NullPointerException
at com.wezka.nativecamera.CameraActivity.initPreview(CameraActivity.java:415)
at com.wezka.nativecamera.CameraActivity.access$1300(CameraActivity.java:57)
at com.wezka.nativecamera.CameraActivity$7.surfaceChanged(CameraActivity.java:463)
at android.view.SurfaceView.updateWindow(SurfaceView.java:545)
Hi,
could you publish your plugin to npm?
I am using phonegap build and can just use plugins from npm or phonegabBuild.
Would be nice to see this great plugin on npm!
Thanks
Bastian
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.