2016-06-11 57 views
0

我開發了一個使用科爾多瓦的混合應用程序。我上傳到谷歌播放和應用程序商店。用戶報告他們正在收到消息「不幸的是,xxx已關閉」(xxx代表應用程序名稱)。在測試時,我無法再現問題。奇怪的部分是用戶在不使用我的應用程序時收到此消息。我已經安裝在我的應用程序科爾多瓦應用程序意外關閉

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用戶沒有得到這個消息大跌以下插件。只有android用戶報告了這個問題。

這裏是我的AndroidManifest.xml文件

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

我在我的兩個代碼的功能,它可以自動調用。兩者都用於將數據同步到服務器。

$interval(function() { 
     var isOnline = $cordovaNetwork.isOnline(); 
     if (isOnline) { 
      $scope.syncData(); 
     } 
    }, 900000) 

$rootScope.$on('$cordovaNetwork:online', function(event, networkState) { 
     if ($scope.isLoggedIn) { 
      var onlineState = networkState; 
      console.log('Online State', onlineState); 
      $scope.syncData(); 
     } 

    }); 

請問這個函數調用的背景是什麼?應用程序關閉後,此功能是否會繼續? 調試期間我找不到任何不尋常的東西。 任何人都可以幫助我嗎?

更新

我發現了兩個場景出現這種情況:

  1. 我改變網絡狀態,由於飛行模式,網絡 問題。突然我收到消息說,不幸xxx已經停止
  2. 我的GPS被禁用。我試圖打開谷歌地圖。我從Google地圖獲得了一條 消息以啓用GPS。在我啓用GPS的時候,我 得到了不幸的是XXX已經停止

回答

1

正如this question提到的,這是一個錯誤[email protected]引起的消息,指出作爲plugin repoissue #85,並通過補丁發佈[email protected]解決。更新插件並重建應用程序應該可以解決問題:

$ cordova plugin rm cordova.plugins.diagnostic && 
    cordova plugin add [email protected] && 
    cordova build android --release 
+0

感謝您的快速響應。我沒有注意到這個問題。事實上,我並不知道哪個插件會導致此錯誤。發生此問題時我發現了兩種不同的情況。我也提出了我的問題。我正在使用診斷插件來檢查GPS權限狀態。所以這可能是第二種情況的問題。但是第二種情況的原因是什麼?任何想法 ? –

+0

這兩種情況都是由上述錯誤引起的,並且會通過更新插件來解決。 – DaveAlden

+0

好的,謝謝。我剛剛更新了插件。讓我嘗試一些隨機測試用例。感謝您的迴應並指出了這一點 –