android - Cordova app closes unexpectedly -


i developed hybrid app using cordova. uploaded google play , app store. users reported getting message "unfortunately, xxx has closed" (xxx represents app name). while testing not able reproduce issue. strange part users message when not using app. had following plugins installed in app

cordova-plugin-camera 2.2.1-dev "camera" cordova-plugin-compat 1.0.0 "compat" cordova-plugin-device 1.1.1 "device" cordova-plugin-file 4.1.0 "file" cordova-plugin-file-transfer 1.5.0 "file transfer" cordova-plugin-geolocation 2.1.0 "geolocation" cordova-plugin-inappbrowser 1.4.0 "inappbrowser" cordova-plugin-network-information 1.2.0 "network information" cordova-plugin-splashscreen 3.2.2 "splashscreen" cordova-plugin-statusbar 2.1.4-dev "statusbar" cordova-plugin-whitelist 1.2.2 "whitelist" cordova-plugin-x-toast 2.3.2 "toast" cordova-sqlite-storage 0.7.14 "cordova sqlite storage plugin" cordova.plugins.diagnostic 3.0.2 "diagnostic" ionic-plugin-keyboard 2.2.0 "keyboard" phonegap-plugin-barcodescanner 5.0.0 "barcodescanner" phonegap-plugin-push 1.6.4 "pushplugin" 

ios users not getting crash message. android users reported issue.

here androidmanifest.xml file

<?xml version='1.0' encoding='utf-8'?> <manifest android:hardwareaccelerated="true" android:versioncode="1" android:versionname="0.0.1" package="com.xxx.yy" xmlns:android="http://schemas.android.com/apk/res/android">     <supports-screens android:anydensity="true" android:largescreens="true" android:normalscreens="true" android:resizeable="true" android:smallscreens="true" android:xlargescreens="true" />     <uses-permission android:name="android.permission.internet" />     <application android:hardwareaccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:supportsrtl="true">         <activity android:configchanges="orientation|keyboardhidden|keyboard|screensize|locale" android:label="@string/activity_name" android:launchmode="singletop" android:name="mainactivity" android:screenorientation="portrait" android:theme="@android:style/theme.devicedefault.noactionbar" android:windowsoftinputmode="adjustresize">             <intent-filter android:label="@string/launcher_name">                 <action android:name="android.intent.action.main" />                 <category android:name="android.intent.category.launcher" />             </intent-filter>         </activity>         <receiver android:name="cordova.plugins.diagnostic$locationproviderchangedreceiver">             <intent-filter>                 <action android:name="android.location.providers_changed" />             </intent-filter>         </receiver>         <activity android:cleartaskonlaunch="true" android:configchanges="orientation|keyboardhidden|screensize" android:exported="false" android:name="com.google.zxing.client.android.captureactivity" android:theme="@android:style/theme.notitlebar.fullscreen" android:windowsoftinputmode="statealwayshidden">             <intent-filter>                 <action android:name="com.google.zxing.client.android.scan" />                 <category android:name="android.intent.category.default" />             </intent-filter>         </activity>         <activity android:label="share" android:name="com.google.zxing.client.android.encode.encodeactivity">             <intent-filter>                 <action android:name="com.phonegap.plugins.barcodescanner.encode" />                 <category android:name="android.intent.category.default" />             </intent-filter>         </activity>         <activity android:label="share" android:name="com.google.zxing.client.android.helpactivity">             <intent-filter>                 <action android:name="android.intent.action.view" />                 <category android:name="android.intent.category.default" />             </intent-filter>         </activity>         <activity android:exported="true" android:name="com.adobe.phonegap.push.pushhandleractivity" />         <receiver android:name="com.adobe.phonegap.push.backgroundactionbuttonhandler" />         <receiver android:exported="true" android:name="com.google.android.gms.gcm.gcmreceiver" android:permission="com.google.android.c2dm.permission.send">             <intent-filter>                 <action android:name="com.google.android.c2dm.intent.receive" />                 <category android:name="${applicationid}" />             </intent-filter>         </receiver>         <service android:exported="false" android:name="com.adobe.phonegap.push.gcmintentservice">             <intent-filter>                 <action android:name="com.google.android.c2dm.intent.receive" />             </intent-filter>         </service>         <service android:exported="false" android:name="com.adobe.phonegap.push.pushinstanceidlistenerservice">             <intent-filter>                 <action android:name="com.google.android.gms.iid.instanceid" />             </intent-filter>         </service>         <service android:exported="false" android:name="com.adobe.phonegap.push.registrationintentservice" />     </application>     <uses-sdk android:minsdkversion="16" android:targetsdkversion="23" />     <uses-permission android:name="android.permission.write_external_storage" />     <uses-permission android:name="android.permission.access_coarse_location" />     <uses-permission android:name="android.permission.access_fine_location" />     <uses-permission android:name="android.permission.access_network_state" />     <uses-permission android:name="android.permission.access_wifi_state" />     <uses-permission android:name="android.permission.camera" />     <uses-permission android:name="android.permission.flashlight" />     <uses-feature android:name="android.hardware.camera" android:required="false" />     <uses-permission android:name="android.permission.wake_lock" />     <uses-permission android:name="android.permission.vibrate" />     <uses-permission android:name="com.google.android.c2dm.permission.receive" />     <permission android:name="${applicationid}.permission.c2d_message" android:protectionlevel="signature" />     <uses-permission android:name="${applicationid}.permission.c2d_message" /> </manifest> 

i had 2 functions in code, invoke automatically. both used sync data server.

$interval(function() {         var isonline = $cordovanetwork.isonline();         if (isonline) {             $scope.syncdata();         }     }, 900000) 

and

$rootscope.$on('$cordovanetwork:online', function(event, networkstate) {         if ($scope.isloggedin) {             var onlinestate = networkstate;             console.log('online state', onlinestate);             $scope.syncdata();         }      }); 

will functions call in background ? functions persist after app close ? couldn't find unusual during debug. can me ?

update

i found 2 scenarios occurred:

  1. i changing network state flight mode due network issue. got message unfortunately xxx has stopped
  2. my gps disabled. trying open google maps. got message google map enable gps. @ time enabled gps, got message unfortunately xxx has stopped

as mentioned in this question, caused bug in cordova.plugins.diagnostic@3.0.2, noted issue #85 in plugin repo , resolved patch release cordova.plugins.diagnostic@3.0.4. updating plugin , rebuilding app should resolve issue:

$ cordova plugin rm cordova.plugins.diagnostic &&    cordova plugin add cordova.plugins.diagnostic@3.0.4 &&   cordova build android --release 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -