getPicture crashes app, i want to call garbage collector manually

6 posts, 0 answers
  1. pistoleta
    pistoleta avatar
    1 posts
    Member since:
    Jan 2014

    Posted 19 Feb 2014 Link to this post

    Hi, im comfronting a very common trouble in cordova.  
    The camera plugin makes some devices crash due to the amount of memory it uses processing the picture and i tried everything:
    -lowering picture quality
    -lowering picture resolution
    -using  FILE_URI, instead of Base64 
    - <uses-sdk android:minSdkVersion="7" />

    And still, SOMETIMES my app restarts after trying to save the picture, normally if the app restarts and i try to take the picture again then it works, so that makes me thing its the memory that got flushed by garbage collector and the second time has space.
    Also, im using devices with low ram memory, (128),  but i cant change that for the moment.

    I want to make a plugin i can use to call the native java method System.gc();   just before processing the picture, so that way probably the app wont crash.
    I also found this plugin:

    But this is supposed to work with cordova 2.4.0 and im on 3.0 and btw i dont know how to add that plugin to appBuilder...
    Can anyone tell me wich is the best sollution to solve this please? I dont want to go to phonegap cause i find appbuilder more efficient but i really dont know how to solve this. 
    THANKS in advance.

  2. Jan-Dirk
    Jan-Dirk avatar
    327 posts
    Member since:
    Jun 2012

    Posted 19 Feb 2014 in reply to pistoleta Link to this post

    It could be that the plugin works with Phonegap 3.x? You could always set your project in AppBuilder to an older version in project properties.

    Else, start trying to make the plugin plugman compatible: After that you should be able to import the plugin:

    It seems that all the sources are available through the link in your post.

    It's a little work, but could be very helpfull.
  3. pistoleta
    pistoleta avatar
    1 posts
    Member since:
    Nov 2013

    Posted 19 Feb 2014 in reply to Jan-Dirk Link to this post

    Hi, finnally i was able to do it,  i found this project:

    i just had to add it with the plugin manager and use the examples found in the test folder, very easy, i didnt use the plugman it wasnt needed for this plug-in.   May be another time but i find the plugman stuff really complicated and not well documented.

    Ah. in order to work you need to disable the native camera plugin otherwise wont use the new.

  4. Iva Koevska
    Iva Koevska avatar
    286 posts

    Posted 24 Feb 2014 Link to this post


    Thanks for sharing this solution!

    Iva Koevska
    Icenium is now Telerik AppBuilder, and is part of the Telerik Platform. For more information on the new name, and to learn more about the Platform, register for the free online keynote and webinar on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT)
  5. Jaya
    Jaya avatar
    1 posts
    Member since:
    Aug 2016

    Posted 24 Aug in reply to pistoleta Link to this post


    i have tried but always getting error,

    please explain how to implement foreground camera for ios step by step briefly.




  6. Preslav
    Preslav avatar
    39 posts

    Posted 29 Aug Link to this post

    Hi Jaya,

    Foreground camera plugin runs a custom activity which is supported only on Android, that is way it's not working on iOS. Additionally, it is a fork of the official Cordova Camera plugin, which is a Core plugin in AppBuilder. More information about core plugins is available in this section.

    I'd recommend using the Cordova Camera plugin. To get more familiar with it, check our sample app and plugins documentation.

    Further, if you are still getting errors I'll be happy to continue my investigation but for that purpose, I'll need a sample app that clearly reproduces the issue. I'd recommend that you open a support ticket, which is private and comes with a guaranteed response time, and share all the needed information there.

    Telerik by Progress

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

Back to Top