cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-8804) https://github.com/apache/cordova-plugin-camera#android-quirks
Date Mon, 22 Jun 2015 09:43:00 GMT

    [ https://issues.apache.org/jira/browse/CB-8804?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14595585#comment-14595585
] 

ASF GitHub Bot commented on CB-8804:
------------------------------------

Github user thehuijb commented on the pull request:

    https://github.com/apache/cordova-plugin-camera/pull/97#issuecomment-114052451
  
    ## How a cordova camera application works on android
    
    This is basically  how a cordova application works:
    ![image00](https://cloud.githubusercontent.com/assets/902441/8279233/f8407912-18d2-11e5-8761-7fd55deaa3c7.png)
    - User presses App-icon
    - Applications start
    - Mainactivity start
    - Java side of plugins included
    - WebView initialized
    - Html loads
    - javascript side of plugins loaded
    - onDeviceReady fired
    
    Now we have our application up and running.
    It’s time to take a picture
    ![image01](https://cloud.githubusercontent.com/assets/902441/8279256/2814f032-18d3-11e5-9abd-d349185ab3f5.png)
    
    - We call getPicture
    - The call goes to the CordovaBridge
    - CordovaBridge uses the PluginManager to pass it to the camera Plugin
    - Camera plugin launches a camera Activity
    
    Now that a camera Activity is running, our MainActivity is pushed to the background, onPause
is fired.
    
    When the Camera Activity finished the MainActivity is called again via onActivityResult
    ![image02](https://cloud.githubusercontent.com/assets/902441/8279282/6a7ddf10-18d3-11e5-8b43-67675a2f61dc.png)
    
    the result is dispatched to the javascript succesFunction where our application can then
do with it as planned.
    That’s what happens in a high memory availability scenario, a happy flow.
    
    Now what happens when there isn’t enough memory left and the OS decides to kill our
MainActivity?
    ![image03](https://cloud.githubusercontent.com/assets/902441/8279295/97699f1e-18d3-11e5-9776-a41f8d87dea3.png)
    
    - CameraActivity is finished and sends its result back to the activity that launched it.
    - Our MainActivity, is started.
    - Java side of plugins included
    - onActivityResult fires
    - plugin fails to send result back to the javascript because it is not there anymore
    - a completely new WebView is initialized
    - Html loads
    - javascript side of plugins loaded
    - onDeviceReady fired
    
    the precise order of event could differ on occasion but that doesn’t matter because
the entire webview has to be rebuilt and with it all the javascript therefor the callback
can never be completed in this situation.
    You will always have to call a method in (or after) onDeviceReady to solve this problem.
    
    Serge


> https://github.com/apache/cordova-plugin-camera#android-quirks
> --------------------------------------------------------------
>
>                 Key: CB-8804
>                 URL: https://issues.apache.org/jira/browse/CB-8804
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: Plugin Camera
>         Environment: Android
>            Reporter: Serge Huijben
>
> Android Quirks
> Android uses intents to launch the camera activity on the device to capture images, and
on phones with low memory, the Cordova activity may be killed. In this scenario, the image
may not appear when the Cordova activity is restored.
> It can be solved bij implementing this PR: https://github.com/apache/cordova-plugin-camera/pull/97



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message