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-8768) if MainActivity is killed by Android OS after a plugin started a new activity onActivityResult gets called before the plugin needed to handle the result is loaded
Date Mon, 30 Mar 2015 14:12:53 GMT

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

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

Github user thehuijb commented on a diff in the pull request:

    https://github.com/apache/cordova-android/pull/170#discussion_r27392930
  
    --- Diff: framework/src/org/apache/cordova/CordovaActivity.java ---
    @@ -314,10 +318,52 @@ public void startActivityForResult(Intent intent, int requestCode,
Bundle option
          * @param intent            An Intent, which can return result data to the caller
(various data can be attached to Intent "extras").
          */
         @Override
    -    protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
    +    protected void onActivityResult(final int requestCode, final int resultCode, final
Intent intent) {
             LOG.d(TAG, "Incoming Result. Request code = " + requestCode);
             super.onActivityResult(requestCode, resultCode, intent);
    -        cordovaInterface.onActivityResult(requestCode, resultCode, intent);
    +        // check if plugins are ready to receive the result
    +        if (this.pluginsReady) {
    +            cordovaInterface.onActivityResult(requestCode, resultCode, intent);
    +            this.findCallbackTries = 0;
    +        } else {
    +            /**
    +             * If the Android OS kills this activity when a plugin launches an a new
activity 
    +             * the onActivityResult event fires before the onResume event 
    +             * so we have to wait for the plugins to be loaded again before we can hand
the result to the correct plugin.
    +             */
    +            final ScheduledThreadPoolExecutor exec = new ScheduledThreadPoolExecutor(1);
    --- End diff --
    
    thanks for having a look and commenting.


> if MainActivity is killed by Android OS after a plugin started a new activity onActivityResult
gets called before the plugin needed to handle the result is loaded
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CB-8768
>                 URL: https://issues.apache.org/jira/browse/CB-8768
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>            Reporter: Serge Huijben
>
> if one of the plugins launches startActivityForResult and the Android OS decides to kill
our MainActivity. what happens when the launched activity is closed.
> the previous activity (our MainActivity is relaunched and onActivityResult is called,
our mainActivity however has not yet had the time to load all onload=true plugins so therefore
the savedInstanceState callBackService can not be called.



--
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