0
昨天在Play商店發佈了一個新應用程序,該應用程序已經使用/測試了幾個月沒有問題的應用程序,但從Play商店下載的版本無法訪問互聯網(假設)。從Cordova CLI運行應用程序時從未遇到此問題。通過Play商店下載後,Cordova應用程序無法使用互聯網
該應用程序在啓動時連接到服務器上有一個登錄頁面 - 我可以在應用程序設置中看到應用程序根本沒有使用任何數據,也沒有在應用程序或日誌貓中拋出錯誤(adb logcat
) 。
可能是什麼問題?詳情如下;
測試的設備
- HTC10(安卓7.0)
- 谷歌像素(安卓7.1.2)
的Config.xml
<access origin="*" />
清單
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="25" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<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" />
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
<uses-permission android:name="${applicationId}.permission.PushHandlerActivity" />
<permission android:name="${applicationId}.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<permission android:name="${applicationId}.permission.PushHandlerActivity" android:protectionLevel="signature" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
CSP
<meta http-equiv="Content-Security-Policy" content="default-src * gap://ready; connect-src * ws: wss:; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' data: *">
驗證模型
login: function(un, pw, onProgress, onSuccess, onAbort, onError) {
var params = {
username: un,
password: pw,
};
var httpHeaders = {
'X-CSRF-Token': app.token
};
app.authRemote.restClient.call(config.serverURL + '/' + config.serviceEndPoint + '/endpoint/login', JSON.stringify(params), {requestMethod: 'POST', requestDataType: 'application/json', httpHeaders: httpHeaders, responseDataType: 'json'},
function _onProgress() {
onProgress(app.authRemote.restClient);
},
function _onSuccess(result) {
onSuccess(result);
},
function _onAbort() {
onAbort();
},
function _onError(error) {
onError(error);
}
);
},
驗證控制器
this.login = function(username, password, onSuccess, onError){
app.authRemote.login(username, password,
function _onProgress(restClient) {
console.log('Sent = ' + restClient.bytesSent + ' | received = ' + restClient.bytesReceived);
},
function _onSuccess(data) {
onSuccess(data);
},
function _onAbort() {
},
function _onError(error) {
onError(error);
}
);
};
控制檯從logcat的
07-14 11:03:52.092 18738 18738 D SystemWebChromeClient: file:///android_asset/www/js/modules/system/controllers/auth-controller.js: Line 670 : Sent = 0 Bytes | received = 0 Bytes