Search Unity

Easy Code Scanner Unity plugin for Android and iOS

Discussion in 'Assets and Asset Store' started by C4MProdDev, Nov 22, 2012.

  1. Aurigan

    Aurigan

    Joined:
    Jun 30, 2013
    Posts:
    291
    Hi - i've got the plugin installed in my Android project and working as expected (awesome!). Couple of questions:

    > how do i hide the status bar whilst scanning?
    > can you provide an example of a custom scanner overlay? It's unclear to me from the readme how i'd achieve this.

    great plugin so far, many thanks!
     
  2. Damien_C4M

    Damien_C4M

    Joined:
    Feb 8, 2013
    Posts:
    55
    @Aurigan

    On android you will have to modify the source code Under Eclipse and then regenerating the EZCodeScanner.jar of the plugin under /Assets/Plugins/Android. On iPhone you will have to modify the EZCodeScannerViewController.mm file under /Assets/Plugins/iOS.

    > how do i hide the status bar whilst scanning?
    Android:
    You have to add the following code

    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    before the setContentView call in the onCreate() method of CameraActivity.java

    iPhone:
    In the initWithUI method of EZCodeScannerViewController.mm add the following code :
    [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];

    don't forget to put it to NO before leaving if necessary.

    > can you provide an example of a custom scanner overlay? It's unclear to me from the readme how i'd achieve this.
    Android:
    That's simple, you have to tweak the CameraUI.java file

    iPhone:
    Almost the same on iPhone, you would have to tweak the (void) init_ui method of EZCodeScannerViewController.mm file


    Hope it helps and if you like the plugin we would be glad to see a nice rating ;)
     
  3. Aurigan

    Aurigan

    Joined:
    Jun 30, 2013
    Posts:
    291
    Hey, thanks for the speedy reply. The Android change didn't work to remove the status bar on an HTC One/4.1.2 - are there any other steps needed?

    I'd love to leave a 5* review but like others in the thread i'm getting some incorrect results on scanning barcodes initially ... still trying to work out what's really going on there as after a few scans it appears to become 100% accurate. Even more strange ... i frequently get the same incorrect code returned (0081200001141). I have the scanner launching with symbols set to 13.

    Also, for $75 i'd expect to be able to set everything asked for in this thread from inside unity rather than needing to hack on the bundled source files or have to change build settings in xcode etc. Still, promising start!
     
  4. Menace3

    Menace3

    Joined:
    Jul 17, 2013
    Posts:
    2
    I just purchased EasyCode and its working!..., but there is no way to cancel the scan. It keeps trying to scan forever.

    Is there a way to cancel the scanning?

    Also tried to download the 30 second .jar file on the previous page, but it won't let me. Any problems with the FTP server?
     
  5. WolfandVoid

    WolfandVoid

    Joined:
    Feb 20, 2013
    Posts:
    6
    Hey,

    thanks, we just released the game on the App Store and are currently looking to release the game for Android as well. Link in my signature if you wanna give it a go :) Tekken Card Tournament looks great, can't wait to try it out :)

    Thanks for the help along the way guys!
     
    Last edited: Jul 18, 2013
  6. Menace3

    Menace3

    Joined:
    Jul 17, 2013
    Posts:
    2
    Correction: There is a cancel button on IOS. I assume the back button is used on Android. Can you check the FTP download for that 30 second timeout JAR file? Or send it to me directly? Thanks!!
     
  7. Damien_C4M

    Damien_C4M

    Joined:
    Feb 8, 2013
    Posts:
    55
  8. angelodelvecchio

    angelodelvecchio

    Joined:
    Nov 15, 2012
    Posts:
    170
    Dear Friend,

    I dont know about eclipse and android project,
    can you please publish a video saying step by step how to configure this great plugin for Unity on Android please?

    Many thanks
     
  9. angelodelvecchio

    angelodelvecchio

    Joined:
    Nov 15, 2012
    Posts:
    170
    Dear Friend,

    I dont know about eclipse and android project,
    can you please publish a video saying step by step how to configure this great plugin for Unity on Android please?

    Many thanks
     
  10. angelodelvecchio

    angelodelvecchio

    Joined:
    Nov 15, 2012
    Posts:
    170
    I moved Android to /Assets/Plugins with the 2 JAR and the AndroidManifest file, but when the application runs it crashes and come back to desktop, dont even show the scene
     
  11. Damien_C4M

    Damien_C4M

    Joined:
    Feb 8, 2013
    Posts:
    55
    Hi angelodelvecchio,

    If it crashes immediately, it certainly doesn't find some files or your activities haven't been declared in the Manifest. Have you followed the README file? Have you modified the Manifest files to fit your needs?

    Regards
     
  12. angelodelvecchio

    angelodelvecchio

    Joined:
    Nov 15, 2012
    Posts:
    170

    Dear friend, I messed like a crazy with that and suddenly are working, of course that there is no plugin issues, i dont know about these android things,

    The Plugin Works great ! Many thanks!
     
  13. Crismis

    Crismis

    Joined:
    Oct 1, 2013
    Posts:
    1
    We have a problem using Easy Code Scanner for IOS7. It worked in IOS6, but now after calling the launchScanner method several times the program starts to slow down eventually crashing.
     
  14. Aurigan

    Aurigan

    Joined:
    Jun 30, 2013
    Posts:
    291
    getting the same issues as Crismis - reports of crashing on iOS7/5s, buying a phone today to do some further debug.
     
  15. Damien_C4M

    Damien_C4M

    Joined:
    Feb 8, 2013
    Posts:
    55
    @Crismis Aurigan

    Thanks for reporting it.

    We are aware of this issue, it is related to memory management and scanner allocations issues since iOS7 :
    http://stackoverflow.com/questions/...-reaching-100-cpu-use-and-memory-more-than-10

    The fix is in progress and mainly rely on the scanner instance not released in the plugin (to be able to call methods on it such as getting images).
    We will provide a fix by tomorrow, thanks for your patience.

    Regards
     
  16. Aurigan

    Aurigan

    Joined:
    Jun 30, 2013
    Posts:
    291
    thanks for letting us know this is in progress/will be fixed soon, really appreciated.
     
    Last edited: Oct 9, 2013
  17. Damien_C4M

    Damien_C4M

    Joined:
    Feb 8, 2013
    Posts:
    55
    Hi,

    A plugin update (v2.0) has been submitted to the Unity3D AssetStore and is under review, which fixes the iOS7 crash issue. It should be available shortly.

    Best,

    Damien
     
  18. Eugenio

    Eugenio

    Joined:
    Mar 21, 2013
    Posts:
    197
    Hi Damien.
    I'm using your plugin on both Android and iOS and I'm very happy about it: it is simple and efficient. Great job.

    By the way, today I've started the developing of an AR app using Vuforia. I have a camera feed and a tracking system that will recognize a marker on the feed.
    It is requested the possibility to scan a QRCode to download some online packages. I've integrated your plugin in this app but basically when I come back from the scanner, Vuforia is no more able to provide a camera feed. I've tested this on Android and I'm having an error from NvOmxCamera saying "Already called release()". I don't know if the things are related.

    Can you please help me to find a solution for this little issue?

    Thank you very much.


    EDIT: sorry, but I must add that this issue will happen only if I disable the videofeed before the QRCode reader call and try to re-enable it after the callback with the code read. Sorry about that.
     
    Last edited: Oct 30, 2013
  19. Damien_C4M

    Damien_C4M

    Joined:
    Feb 8, 2013
    Posts:
    55
    @Eugenio

    We are also using Vuforia for AR tag detection and QRCode detection is a same game and do not have these troubles.
    On our side we are not disabling the videofeed before QRCode reader and re-enabling if after and most importantly what you have to make sure is that the QCARProxyActivity form Qualcomm is the main Activity of your project or you will experience videofeed issues.
     
  20. Eugenio

    Eugenio

    Joined:
    Mar 21, 2013
    Posts:
    197
    Hi there. As far as I could understand is an Android problem only: basically if I disable the QCARBehaviour script, call the scanner, go back with or without the read code and re-enable the QCARBehaviour the video feed will not start again. My workaround was to make a coroutine that will enable, disable and enable again (after a frame) the Behaviour and in this way all is working fine. If I don't disable the QCARBehaviour nothing will happen.

    I made a further test and apparently this will happen not only with your plugin but also if you put the Android app into the background (lets say to open the internet browser) and then come back. If in the process the app switch you will disable and then re-enable (like in the OnPause Unity function) the QCARBehaviour that will cause the video feed to not work properly.

    Sorry for asking you, your plugin has nothing to do with this. :-(
     
  21. fortunacus

    fortunacus

    Joined:
    Sep 25, 2013
    Posts:
    43
    the camera isn t work on android, help me. it only displayed launch scanner button and blank grey box, no camera work
     
  22. fortunacus

    fortunacus

    Joined:
    Sep 25, 2013
    Posts:
    43
    btw i use samsung galaxy s3 mini
     
  23. zhangjiedy

    zhangjiedy

    Joined:
    Nov 15, 2013
    Posts:
    1
    How can I put the transparent button on the Camera View in Unity3d. please help me
     
  24. Damien_C4M

    Damien_C4M

    Joined:
    Feb 8, 2013
    Posts:
    55
    @fortunacus
    The camera should launch when you press the launch scanner button. If it crashes it certainly means that you haven't declared the required activity in the manifest or the plugin files are at the wrong place.


    @zhangjiedy
    About changing the visual, the plugin currently draws the interface thanks to internal drawRects without any external assets (both Android iPhone). We haven't found yet a proper way to load an external PNG file in the EasyCodeScanner plugin since a Unity plugin doesn't have access to the Unity project resource files (JNI / external package).
    Anyway, it is still possible to display backgrounds or images in the scanner by converting the image data into an int array, embedding them in the code (in a Data class for instance) and then load the image directly from the code.

    For instance on Android:

    public static final int[] img1 = { 0, 0, 0, 50331647, 83886079, 134217727, 201326591, 251658239, 318767103,....218103807, 134217727, 83886079, 33554431, 0, 0, 0];

    Bitmap bitmap = Bitmap.createBitmap(Data.img1, width, height, Bitmap.Config.ARGB_888;
    ImageView mImage = new ImageView(this);
    mImage.setImageBitmap(bitmap);
     
  25. fortunacus

    fortunacus

    Joined:
    Sep 25, 2013
    Posts:
    43
    i see, but how about if I press the lauch but no camera activity? i try work on it, there is no camera activity on press launch, should I change the package name with my own?
     
  26. Damien_C4M

    Damien_C4M

    Joined:
    Feb 8, 2013
    Posts:
    55
  27. Eugenio

    Eugenio

    Joined:
    Mar 21, 2013
    Posts:
    197
    Hi guys.
    I don't know if this question has already been asked but I need to know if there is a possibility to launch the scanner and fix its rotation.
    I know that there is a ForceLandscape bool to set in the function, but what about having the scanner just in portrait mode and prevent it to rotate?
    Is it actually possible?

    Thanks :)
     
  28. Damien_C4M

    Damien_C4M

    Joined:
    Feb 8, 2013
    Posts:
    55
    @Eugenio

    Yes I guess it is definitely possible on both Android and iOS.

    on Android

    In Assets/Plugins/Android/project/src/com/c4mprod/ezcodescanner/camera/CameraActivity.java line 181 :
    Just comment like to following
    then recomplile the jar by re-exporting the library in Eclipse.

    on iOS

    You should normally only have to specify that the unity project is is portrait and since the camera is pushed from the unity controller the orientation should follow.
     
  29. Eugenio

    Eugenio

    Joined:
    Mar 21, 2013
    Posts:
    197
    Hi Damien and thanks for your answer.
    To be honest with you I tried both version and on Android is working: I fixed the view from the AndroidManifest.xml.
    On iOS, instead, also if my Unity app (and project) has been fixed in portrait mode, the scanner view is still rotating in any direction based on the device orientation. I've tested this on both iOS 6 and iOS 7. Is there anything I can do to prevent this?

    Thank you very much again :)
     
  30. Damien_C4M

    Damien_C4M

    Joined:
    Feb 8, 2013
    Posts:
    55
    #Eugenio

    Have you tried to add the following methods in the Assets/Plugins/iOS/EZCodeScannerViewController.mm :

    IOS 5

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
    }

    IOS 6

    -(BOOL)shouldAutorotate{
    return YES;
    }

    -(NSInteger)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskPortrait;
    }

    I will make tests on my side and let you know as well.
     
  31. Eugenio

    Eugenio

    Joined:
    Mar 21, 2013
    Posts:
    197
    Hi again Damien.

    I tried as you said but nothing has changed.
    To be honest with you I'm experiencing a lot of strange behaviours with Xcode but I don't know if this is related to this.

    If I can ask you another thing: do you know a way to completely remove Xcode 5 and have a new clean installation without preferences, history, etc..?
    I think that after the upgrade from the version 4 something went really wrong.

    Cheers
     
  32. Broccoli

    Broccoli

    Joined:
    Sep 2, 2010
    Posts:
    28
    Is this asset still active?
    I am decide on buying but I cannot open your youtube demo video link.
     
  33. Damien_C4M

    Damien_C4M

    Joined:
    Feb 8, 2013
    Posts:
    55
    @Broccoli : Yes the asset is still active, the video has been temporarily removed and will be updated soon.
     
  34. Damien_C4M

    Damien_C4M

    Joined:
    Feb 8, 2013
    Posts:
    55
    @Eugenio

    Yes update from XCode4 to XCode5 is a bit painful, on my side I deleted completely XCode 4 to install XCode 5.
    About the device orientation, I made other tries and I haven't found a way yet to completely lock the interface in an easy way.
     
  35. Eugenio

    Eugenio

    Joined:
    Mar 21, 2013
    Posts:
    197
    About XCode: in fact I did it and now it seems to work. :)
    About locking the plugin: it's ok, I think I can live with it. ;-) Cheers.
     
  36. Broccoli

    Broccoli

    Joined:
    Sep 2, 2010
    Posts:
    28
    ok thanks. then I going pick this one :cool:
     
  37. Broccoli

    Broccoli

    Joined:
    Sep 2, 2010
    Posts:
    28
    I have a problem here

    In Android Platform
    After I have Import the package,
    I click build and run, In app when I click at "Launch scanner" >> nothing happen

    Did I miss any of step I should do here?

    I am using unity 4.2 and target to android 2.2

    Thank you,

    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    After I am tried with logcat, These are some in red text. So I think there might be some clue here:

    12-10 00:21:30.446: E/NativeActivity(18404): channel '4056d978 com.c4mprod.ezcodescanner/com.unity3d.player.UnityPlayerNativeActivity (client)' ~ Failed to receive dispatch signal. status=-11
    12-10 00:21:30.496: E/NativeActivity(18404): channel '4056d978 com.c4mprod.ezcodescanner/com.unity3d.player.UnityPlayerNativeActivity (client)' ~ Failed to receive dispatch signal. status=-11
    12-10 00:21:30.546: E/NativeActivity(18404): channel '4056d978 com.c4mprod.ezcodescanner/com.unity3d.player.UnityPlayerNativeActivity (client)' ~ Failed to receive dispatch signal. status=-11
    12-10 00:21:30.566: E/NativeActivity(18404): channel '4056d978 com.c4mprod.ezcodescanner/com.unity3d.player.UnityPlayerNativeActivity (client)' ~ Failed to receive dispatch signal. status=-11
    12-10 00:21:30.576: E/NativeActivity(18404): channel '4056d978 com.c4mprod.ezcodescanner/com.unity3d.player.UnityPlayerNativeActivity (client)' ~ Failed to receive dispatch signal. status=-11
    12-10 00:21:30.596: E/NativeActivity(18404): channel '4056d978 com.c4mprod.ezcodescanner/com.unity3d.player.UnityPlayerNativeActivity (client)' ~ Failed to receive dispatch signal. status=-11
    12-10 00:21:30.616: I/Unity(18404): Exception: java.lang.ClassNotFoundException: com.c4mprod.ezcodescanner.RootActivity
    12-10 00:21:30.616: I/Unity(18404): at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <filename unknown>:0
    12-10 00:21:30.616: I/Unity(18404): at UnityEngine.AndroidJNISafe.CallStaticObjectMethod (IntPtr clazz, IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in <filename unknown>:0
    12-10 00:21:30.616: I/Unity(18404): at UnityEngine.AndroidJavaObject._CallStatic[AndroidJavaObject] (System.String methodName, System.Object[] args) [0x00000] in <filename unknown>:0
    12-10 00:21:30.616: I/Unity(18404): at UnityEngine.AndroidJavaObject.CallStatic[AndroidJavaObject] (System.String methodName, System.Object[] args) [0x00000] in <filename unknown>:0
    12-10 00:21:30.616: I/Unity(18404): at UnityEngine.AndroidJavaObject.FindClass (System.String name) [0x00000] in <filename unknown>:0
    12-10 00:21:30.616: I/Unity(18404): at UnityEngine.AndroidJavaClass._AndroidJavaClass (System.String className) [0x00000] in <filename unknown>:0
    12-10 00:21:30.616: I/Unity(18404): at UnityEngine.AndroidJavaClass..ctor (System.String className) [0x00000] in <filename unknown>:0
    12-10 00:21:30.616: I/Unity(18404): at EasyCodeScanner.launchScanner (Boolean showUI, System.String defaultTxt, Int32 symbol,

    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    EDITED:
    ok, I got it to work now after move around the plugin folder. thanks
     
    Last edited: Dec 10, 2013
  38. Broccoli

    Broccoli

    Joined:
    Sep 2, 2010
    Posts:
    28
    Another question,
    for now in scanner mode it was in landscape but I try to set the orentation to portrait by config manifest file as this one:

    <activity android:name="com.c4mprod.ezcodescanner.camera.CameraActivity" android:screenOrientation="portrait"/>

    but no luck it still landscape.
    what do I miss here?

    Thank you,
     
  39. Damien_C4M

    Damien_C4M

    Joined:
    Feb 8, 2013
    Posts:
    55
    @Broccoli

    Yes that's normal that it does change anything. This question is partially answered by the response I made to Eugenio few post ago. The orientation is handled directly in the java file and ignores the Manifest. To lock the orientation you HAVE to specify it in the C# launchScanner for instance

    EasyCodeScanner.launchScanner( true, "Scanning...", -1, true);
    (public static void launchScanner(bool showUI, string defaultTxt, int symbol, bool forceLandscape) )

    This call will configure the orientation either portrait or landscape. That's the easy way to do it
     
  40. mjwildoer

    mjwildoer

    Joined:
    Jan 9, 2014
    Posts:
    7
    I'm currently using Unity Pro 3.5.7f6 and need to run Easy Code Scanner on that version - is there a way to do this? BTW, we haven't upgraded to v4 due to the cost.
     
  41. C4M

    C4M

    Joined:
    Feb 7, 2013
    Posts:
    20
    I'm sorry, but it would be too much work to support old unity versions.
     
  42. mjwildoer

    mjwildoer

    Joined:
    Jan 9, 2014
    Posts:
    7
    Is it a structural code issue (ie. ECS requires features or libraries in Unity 4), or simply a support issue? I'm willing to try it with Unity v3.5.7 if it's just a support issue, as we will be moving to Unity 4 some day.
     
  43. mjwildoer

    mjwildoer

    Joined:
    Jan 9, 2014
    Posts:
    7
    The Easy Code Scanner v2.0 plugin does actually work in Unity v3.5.7f6.

    I installed ECS in Unity v4.3.2f1, created a new project in Unity v3.5.7f6 and copied over the example 'Assets' folder (moving the 'Plugins' folder directly under the 'Assets' folder). Then I rebuilt the example scene included with ECS (i.e. EasyCodeScanner.unity) in Unity v3.5.7f6 by adding a plane and directional light, compiled it, set 'Enable C++ Exception' to YES, and pushed it onto my iPad Air running iOS 7.

    It worked perfectly when I scanned the bar codes on a box of BBQ Shapes and a can of 4 Bean Mix.

    I understand you only want to support the newest versions of Unity (ie. 4.1.5+), but I think it shows the quality of your work that it will still run on older versions. Thanks for making such an excellent plugin, and keep up the good work.
     
  44. mjwildoer

    mjwildoer

    Joined:
    Jan 9, 2014
    Posts:
    7
    BTW, I just did another test - it runs fine on an iPad 3 with iOS 6 as well.
     
  45. fedor1248

    fedor1248

    Joined:
    Jan 14, 2014
    Posts:
    1
    Demo video links are wrong. Could You create new video?
     
    Last edited: Jan 14, 2014
  46. C4M

    C4M

    Joined:
    Feb 7, 2013
    Posts:
    20
    You're right, you're right, I'll repost a video :)
     
  47. C4M

    C4M

    Joined:
    Feb 7, 2013
    Posts:
    20
  48. CiB7

    CiB7

    Joined:
    Feb 3, 2014
    Posts:
    1
    Android App crashes in landscape(left) mode. Any way to fix that ?
    EDIT: added android:screenOrientation="landscape" on both activities and it works
     
    Last edited: Feb 3, 2014
  49. sajberek

    sajberek

    Joined:
    Dec 14, 2013
    Posts:
    14
    Hi… I just bought it and getting this error:

    ld: file is universal (3 slices) but does not contain a(n) armv7s slice: /Users/michalsuliga/Documents/MyProjects/Unity/BarieroidV2/Build/iOs/Libraries/libzbar.a file '/Users/michalsuliga/Documents/MyProjects/Unity/BarieroidV2/Build/iOs/Libraries/libzbar.a' for architecture armv7s
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    Any help?
     
  50. C4MProdDev

    C4MProdDev

    Joined:
    Jul 9, 2009
    Posts:
    107
    Hi,

    Sorry but you have to change your architecture on your build settings to armv7 only.