Ionic --release App , $http.post not working url https://~~


#1

ionic debug mode
ionic run android
https:// ~~ url = is working

but

ionic build android --release
https://~~ url = is not working

My https.post Code
https.post(‘https://mytestserver01.com/sessions’, getLoginData(), loginConfig)
.then(
function(response){
console.log(“success”);
},
function(error){
console.log(“Error !!!”);
}
);

My Test Devices : LG-F350S (G-Flex)
OS : Android 5.0.1


#2

solution
Ionic Project > /platforms/android/CordovaLib/src/org/apache/cordova/engine/SystemWebViewClient.java

public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error) {

//test - Start
final AlertDialog.Builder builder = new AlertDialog.Builder(parentEngine.cordova.getActivity());
builder.setMessage(“Go to an invalid site.”);
builder.setPositiveButton(“continue”, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
handler.proceed();
}
});
builder.setNegativeButton(“cancel”, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
handler.cancel();
}
});
final AlertDialog dialog = builder.create();
dialog.show();
//test - End

// final String packageName = parentEngine.cordova.getActivity().getPackageName();
// final PackageManager pm = parentEngine.cordova.getActivity().getPackageManager();
//
// ApplicationInfo appInfo;
// try {
// appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA);
// if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
// // debug = true
// handler.proceed();
// return;
// } else {
// // debug = false
// super.onReceivedSslError(view, handler, error);
// }
// } catch (NameNotFoundException e) {
// // When it doubt, lock it out!
// super.onReceivedSslError(view, handler, error);
// }

}