I have uploaded my Cordova app on PlayStore and I got the following reply:
During testing we experienced stability issues with your app and were unable to successfully evaluate it for policy compliance. Please make sure your app behaves predictably at runtime and does not crash, hang, or display error messages.
As I never experienced any stability issues, I figured I'd need to log the errors so that I can see what is going wrong. I tried using Sentry for Cordova, but it's not automatically capturing crashes. I even opened an issue regarding that. But if I manually log any error using Sentry.captureException()
, it's working.
So I wonder if there is a way to Cordova native exceptions so that I manually log them?
CodePudding user response:
Lets see if any errors are being detected
Create a button to your app like this
<button onclick="simulateError()">Simulate an Error</button>
And add this code in a script tag
<script>
const simulateError = () => {
simulateError = false;
}
//Error handler
window.onerror = function(msg, url, linenumber) {
alert('Error message: ' msg '\nURL: ' url '\nLine Number: ' linenumber);
return true;
}
</script>
See if this detects an error
CodePudding user response:
You can give a shot to cordova-plugin-native-logs
A Cordova plugin to retrieve native logs directly from your app to let your users easily share them with you for troubleshooting Those logs will be identical to the ones retrieved by the adb logcat command (Android), or displayed in XCode debugger (iOS)