Search code examples
androidserviceflurry

Flurry does not report all errors


I am using flurry o trace crash and errors in my Android app. I recently discovered a problem where some of my errors (recorded with the onError() method) does not show on the flurry analitycs.

To test if it wasn't some sort of configuration problem or delay, I fired some errors with the same configuration from differents place of my app. As a result I saw that errors fired from activity are correctly received, but some errors fired from my services are not received. I enabled the flurry log, and they say that those errors are sent, but the flurry dashboard does not see them.

For example, an error that is never received is one I fire from a custom UncaughtExceptionHandler, since Flurry does not report service crash either. Here is its code :

    final Context context = this;
    final Thread.UncaughtExceptionHandler uncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
    Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
        @Override
        public void uncaughtException(Thread thread, Throwable ex) {
            Log.e(TAG, "ERROR DETECTED------------------------------------------", ex);
            //Utils.sendFlurryError(context, "serviceCrash", "Uncaught error in Swiper Sevice",new Exception(ex));
            FlurryAgent.onError("serviceCrash","Uncaught error in Swiper Service",ex );
            NotificationManagerCompat manager = NotificationManagerCompat.from(context);
            NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
                    .setContentIntent(PendingIntent.getActivity(context, 42, new Intent(context, AppConstants.LAUNCH_CLASS), 0))
                    .setSmallIcon(R.drawable.icon_notif2)
                            //.setLargeIcon(BitmapFactory.decodeResource(getResources(),R.drawable.logo_rond))
                    .setGroup("swiper")
                    .setAutoCancel(true)
                    .setContentTitle("Swiper")
                    .setContentText("Swiper met an error. Please restart swiper to correct it");
            manager.notify(Notification.SWIPER_NOTIF_ID, builder.build());
           uncaughtExceptionHandler.uncaughtException(thread, ex);
        }

    });

If any of you encountered this kind of bug and know a way around, it would be much appreciated


Solution

  • Check this for crash tracking

    https://www.crashlytics.com/

    This is a good library, made by twitter.