在Cordova android应用程序中使用Crittercism

时间:2016-03-18 04:25:05

标签: cordova cordova-plugins crittercism

我们正试图在我们的Cordova android应用程序中包含Crittercism。

我们在路径https://github.com/crittercism/PhoneGapExampleApp中使用该应用。但我们只看到实时统计中安装的应用程序数量而不是崩溃报告。即使应用程序崩溃,我们也无法在控制台中获取日志。请帮助我们在Cordova应用程序中包含Crittercism并获取崩溃报告。

注意:我们在应用程序崩溃时收到警报。但是我们想要使用免费版的Crittercism,因为我们只需要崩溃日志。

由于JavaScript内存问题,我们可以使用Crittercism进行JavaScript崩溃或崩溃吗?

1 个答案:

答案 0 :(得分:6)

我目前正与Apteligent(以前称为Crittercism)合作,因此我可以提供一些有关您在Cordova应用程序中看到的内容的见解。

未处理的JavaScript错误往往以Handled Exceptions的形式出现,因为应用程序本身通常不会崩溃,而当时这种错误在Basic / Standard上不可用。处理的例外现在可以在标准层上使用,因此如果您仍在标准版上使用我们,您应该能够在左侧的处理例外情况下看到它们。

如果要将JavaScript错误报告为崩溃而不是Handled Exception,则可以使用setLogUnhandledExceptionAsCrash API:

Crittercism.setLogUnhandledExceptionAsCrash(value);
Crittercism.getLogUnhandledExceptionAsCrash();

该值应为布尔值。有关如何使用setLogUnhandledExceptionAsCrash的示例:

function callCriticalBusinessFunction() {
    try {
        setLogUnhandledExceptionAsCrash(true);
        criticalBusinessFunction();
    } finally {
        setLogUnhandledExceptionAsCrash(false);
    }
}