11 Replies Latest reply on Jul 12, 2016 2:23 AM by stoffer1

    OnResume event parameters

    stoffer1 Level 1

      According to the Cordova documentation the parameters passed into an onResume() event should be something like this:

        action: "resume",
        pendingResult: {
        pluginServiceName: string,
        pluginStatus: string,
        result: any


      however when I run my app and get an onResume() event I get something completly different, like this:

      Cordova Resume Event.png

      I am using Cordova build cli.6.1.0


      Why is the event parameter not as expected?

        • 1. Re: OnResume event parameters
          kerrishotts Adobe Employee

          What platform are you testing on? I'm assuming Android, but I want to be sure. What version of Cordova-android is your app using?


          Also, share your code where you start listening for the resume event.


          Finally, are you sure that your app is resuming from a plugin action? If your app isn't, I wouldn't expect there to be much of use in the payload -- note that the sample code in the documentation explicitly tests for the existence of the "pendingResult" property (Android Platform Guide - Apache Cordova ).

          • 2. Re: OnResume event parameters
            stoffer1 Level 1

            Hi, Yes I am using an Android device to test this.


            setup listen for events at start:







            Call camera to get picture:



            navigator.camera.getPicture(onPhotoSuccess, onFail, {

              saveToPhotoAlbum: true,

              quality : 50,

              allowEdit : true,

              destinationType : Camera.DestinationType.FILE_URL,

                sourceType : Camera.PictureSourceType.CAMERA,

              encodingType: Camera.EncodingType.JPEG



            Handle onResume event



            function OnResume(e)





            I have this my config.xml file



            <plugin name="cordova-plugin-camera" source="npm"/>


            When I call the camera getPicture the onPause gets fired and after taking the picture and returning the onResume event is called.


            Hope this all helps.

            • 3. Re: OnResume event parameters
              kerrishotts Adobe Employee

              What version of Cordova-android is your app using?


              If you're using the CLI, you should be able to get this by typing:


              phonegap platforms ls

              • 4. Re: OnResume event parameters
                stoffer1 Level 1


                • 5. Re: OnResume event parameters
                  kerrishotts Adobe Employee

                  Can you share what other plugins (and the version #s) you are using, if any?

                  • 6. Re: OnResume event parameters
                    stoffer1 Level 1

                    Here is the complete config.xml file:


                    <?xml version="1.0" encoding="UTF-8"?>

                      <widget xmlns = "http://www.w3.org/ns/widgets"

                      xmlns:gap = "http://phonegap.com/ns/1.0"

                      xmlns:android = "http://schemas.android.com/apk/res/android"

                      id = "uk.co.cypher1.webworker2"



                      version   = "2.4.4">



                    Live link for engineers to Cypher1


                      <author href="" email="stoff@secsol.co.uk">

                    Chris Holland



                      <platform name="winphone">

                       <preference name="windows-appx-target" value="8.1-phone" />

                      <preference name="windows-identity-name" value="795SECSolutions.1356454AB2530" /> 



                      <platform name="ios">



                      <platform name="android">

                      <supports-screens android:anyDensity="true" android:resizeable="true"




                      android:xlargeScreens="true" />


                      <preference name="android-minSdkVersion" value="10" />

                       <preference name="android-targetSdkVersion" value="20" />

                       <preference name="android-installLocation" value="internalOnly" />

                       <preference name="AndroidPersistentFileLocation" value="Compatibility" />

                      <preference name="android-windowSoftInputMode" value="adjustResize" />

                      <preference name="fullscreen" value="false" />



                      <icon src="icon.png" />


                      <icon src="icon-57.png" gap:platform="ios" width="57" height="57" />

                      <icon src="icon-57@2x.png" gap:platform="ios" width="114" height="114" />


                      <icon src="icon-60.png" gap:platform="ios" width="60" height="60" />

                      <icon src="icon-60@2x.png" gap:platform="ios" width="120" height="120" />

                      <icon src="icon-60@3x.png" gap:platform="ios" width="180" height="180" />


                      <icon src="icon-72.png" gap:platform="ios" width="72" height="72" />

                      <icon src="icon-72@2x.png" gap:platform="ios" width="144" height="144" />


                      <icon src="icon-76.png" gap:platform="ios" width="76" height="76" />

                      <icon src="icon-76@2x.png" gap:platform="ios" width="152" height="152" />


                      <preference name="phonegap-version" value="cli-5.2.0" />

                      <preference name="orientation" value="default" />


                      <preference name="fullscreen" value="true" />


                      <preference name="target-device" value="universal" />


                      <preference name="webviewbounce" value="true" />


                      <preference name="prerendered-icon" value="true" />


                      <preference name="stay-in-webview" value="true" />


                      <preference name="detect-data-types" value="true" />


                      <preference name="exit-on-suspend" value="false" />


                      <preference name="EnableViewportScale" value="true" />


                      <preference name="MediaPlaybackRequiresUserAction" value="false" />


                      <preference name="AllowInlineMediaPlayback" value="false" />


                      <preference name="BackupWebStorage" value="cloud" />


                      <preference name="TopActivityIndicator" value="gray" />


                      <preference name="KeyboardDisplayRequiresUserAction" value="true" />


                      <preference name="HideKeyboardFormAccessoryBar" value="false" />


                      <preference name="SuppressesIncrementalRendering" value="false" />


                      <preference name="ErrorUrl" value=""/>


                      <preference name="BackgroundColor" value="0x000000"/>


                      <preference name="KeepRunning" value="true"/>


                      <preference name="DisallowOverscroll" value="false"/>


                      <preference name="LoadingDialog" value=","/>


                      <preference name="LoadUrlTimeoutValue" value="20000" />


                      <preference name="disable-cursor" value="false" />


                    <plugin name="cordova-plugin-device" source="npm"/>

                    <plugin name="cordova-plugin-device-orientation" source="npm"/>

                    <plugin name="cordova-plugin-file" source="npm"/>

                    <plugin name="cordova-plugin-globalization" source="npm"/>

                    <plugin name="cordova-plugin-inappbrowser" source="npm"/>

                    <plugin name="cordova-plugin-network-information" source="npm"/>

                    <plugin name="cordova-plugin-dialogs" source="npm"/>

                    <plugin name="cordova-plugin-splashscreen" source="npm"/>

                    <plugin name="cordova-plugin-vibration" source="npm"/>

                    <plugin name="cordova-plugin-whitelist" source="npm"/>

                    <plugin name="cordova-plugin-file-transfer" source="npm" />

                    <plugin name="cordova-plugin-camera" source="npm"/>

                    <plugin name="cordova-plugin-barcodescanner" source="npm"/>


                    <allow-navigation href="*"/>

                    <allow-intent href="*" />

                    <access origin="*" />


                    <gap:config-file platform="android" parent="/manifest" mode="merge">







                    • 7. Re: OnResume event parameters
                      VectorP Level 4

                      Not sure if this is the cause of the problem, but I noticed:




                      function OnResume(e)


                      Also, you said:

                      When I call the camera getPicture the onPause gets fired and after taking the picture and returning the onResume event is called.


                      a) an event is not called. You probably meant to say that the event was fired and the eventListener invoked the function.

                      b) ...which I doubt, due to the character case difference above.

                      • 8. Re: OnResume event parameters
                        stoffer1 Level 1

                        Yes, I meant that the onPause() and onResume(e) functions are being called as I expect, it is just that the parameters for the onResume(e) function are not as expected.


                        I thought Javascript was case insensitive!


                        I have tried changing the OnResume(e) to be onResume(e) but for some reason the Cordova Build is failing on Android and IOS this morning (Windows worked okay)

                        • 9. Re: OnResume event parameters
                          stoffer1 Level 1

                          These are the versions of the plugins:


                          cordova-plugin-barcodescanner   npm*0.7.0n/aandroid,ios,winphone
                          cordova-plugin-camera   npm*2.2.0n/aandroid,ios,winphone
                          cordova-plugin-device   npm*1.1.2n/aandroid,ios,winphone
                          cordova-plugin-device-orientation   npm*1.0.3n/aandroid,ios,winphone
                          cordova-plugin-dialogs   npm*1.2.1n/aandroid,ios,winphone
                          cordova-plugin-file   npm*4.2.0n/aandroid,ios,winphone
                          cordova-plugin-file-transfer   npm*1.5.1n/aandroid,ios,winphone
                          cordova-plugin-globalization   npm*1.0.3n/aandroid,ios,winphone
                          cordova-plugin-inappbrowser   npm*1.4.0n/aandroid,ios,winphone
                          cordova-plugin-network-information   npm*1.2.1n/aandroid,ios,winphone
                          cordova-plugin-splashscreen   npm*3.2.2n/aandroid,ios,winphone
                          cordova-plugin-vibration   npm*2.1.1n/aandroid,ios,winphone
                          cordova-plugin-whitelist   npm*1.2.2n/aandroid,ios,winphone
                          • 10. Re: OnResume event parameters
                            VectorP Level 4

                            a) javascript is case sensitive


                            b) it is my impression that you might be confused by different types of resume events:

                            - the resume event which is received by the application once it gets back from being paused into background

                            - the resume event that is fired when a plugin returns results to the application.


                            Your json object from the original question belongs to the latter resume event, while you are trying to apply it to the former.


                            Please compare:

                            Events - Apache Cordova

                            Android Platform Guide - Apache Cordova

                            • 11. Re: OnResume event parameters
                              stoffer1 Level 1

                              I have found it.


                              My application was still running in the background so the image URL was returned correctly to the existing application (just not in the onResume parameter)


                              If I select "Don't Keep Activities" in the developer options then my the onResume contains the expected parameters as my application had been stopped in the background.


                              Thanks for the help.