Class Bugfender


  • public class Bugfender
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Bugfender()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void d​(java.lang.String tag, java.lang.String message)
      Debug Bugfender log method.
      static void disableReflection​(boolean disable)
      Disable reflection when generation log lines.
      static void e​(java.lang.String tag, java.lang.String message)
      Error Bugfender log method.
      static void enableCrashReporting()
      Enable crash reporting tool functionality
      static void enableLogcatLogging()
      Logs all logs written via Logcat.
      static void enableLogcatLogging​(LogcatInterceptor logcatInterceptor)
      Logs all logs written via Logcat.
      static void enableUIEventLogging​(android.app.Application application)
      Logs all actions performed and screen changes in the application, such as button touches, etc...
      static void f​(java.lang.String tag, java.lang.String message)
      Fatal Bugfender log method.
      static void forceSendOnce()
      Synchronizes all logs and issues with the server once, regardless if this device is enabled or not.
      static java.net.URL getDeviceUrl()
      Get a URL pointing to the Bugfender dashboard page for the device.
      static java.net.URL getSessionUrl()
      Get a URL pointing to the Bugfender dashboard page for the device and current session.
      static android.content.Intent getUserFeedbackActivityIntent​(android.content.Context context, java.lang.String title, java.lang.String hint, java.lang.String subjectHint, java.lang.String messageHint, java.lang.String sendButtonText)
      Provides an Intent for opening an Activity to gather the feedback of the users and sent it to Bugfender.
      static android.content.Intent getUserFeedbackActivityIntent​(android.content.Context context, java.lang.String title, java.lang.String hint, java.lang.String subjectHint, java.lang.String messageHint, java.lang.String sendButtonText, FeedbackStyle style)
      Provides an Intent for opening an Activity to gather the feedback of the users and sent it to Bugfender.
      static void i​(java.lang.String tag, java.lang.String message)
      Info Bugfender log method.
      static void init​(android.content.Context context, java.lang.String applicationToken, boolean debug)
      Initialize the Bugfender SDK with a specific application token.
      static void log​(int lineNumber, java.lang.String method, java.lang.String file, LogLevel logLevel, java.lang.String tag, java.lang.String message)
      Bugfender interface for logging, which takes a simple string as log message.
      static void overrideDeviceName​(java.lang.String name)
      Overrides the device name that will be shown in the Dashboard.
      static void removeDeviceKey​(java.lang.String key)
      Remove a device detail.
      static java.net.URL sendCrash​(java.lang.String title, java.lang.String text)
      Send a crash.
      static java.net.URL sendIssue​(java.lang.String title, java.lang.String text)
      Sends an issue
      static java.net.URL sendUserFeedback​(java.lang.String title, java.lang.String message)
      Sends user feedback
      static void setApiUrl​(java.lang.String url)
      Sets the URL of the API
      static void setBaseUrl​(java.lang.String url)
      Sets the URL of the Bugfender Dashboard
      static void setDeviceBoolean​(java.lang.String key, boolean value)
      Sets a device detail with boolean type.
      static void setDeviceFloat​(java.lang.String key, java.lang.Float value)
      Sets a device detail with double type.
      static void setDeviceInteger​(java.lang.String key, java.lang.Integer value)
      Sets a device detail with integer type.
      static void setDeviceString​(java.lang.String key, java.lang.String value)
      Sets a device detail with string type.
      static void setForceEnabled​(boolean enabled)
      Synchronizes all logs and issues with the server all the time, regardless if this device is enabled or not.
      static void setMaximumLocalStorageSize​(long bytes)
      Set the maximum size to store local log files.
      static void t​(java.lang.String tag, java.lang.String message)
      Trace Bugfender log method.
      static void w​(java.lang.String tag, java.lang.String message)
      Warning Bugfender log method.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Bugfender

        public Bugfender()
    • Method Detail

      • init

        public static void init​(android.content.Context context,
                                java.lang.String applicationToken,
                                boolean debug)
        Initialize the Bugfender SDK with a specific application token.
        Parameters:
        context - Application context.
        applicationToken - The application token.
        debug - Boolean that represent if Bugfender sdk should print the logs in console.
      • setMaximumLocalStorageSize

        public static void setMaximumLocalStorageSize​(long bytes)
        Set the maximum size to store local log files.

        By default, the limit is 5 MB.

        Parameters:
        bytes - Maximum size in bytes. Range accepted is from 1 MB to 50 MB. If the value provider is below this range it will be set to 1 MB, if is above the range it will be set to 50 MB
      • t

        public static void t​(java.lang.String tag,
                             java.lang.String message)
        Trace Bugfender log method.
        Parameters:
        tag - String with the tag.
        message - String with the message.
      • i

        public static void i​(java.lang.String tag,
                             java.lang.String message)
        Info Bugfender log method.
        Parameters:
        tag - String with the tag.
        message - String with the message.
      • d

        public static void d​(java.lang.String tag,
                             java.lang.String message)
        Debug Bugfender log method.
        Parameters:
        tag - String with the tag.
        message - String with the message.
      • w

        public static void w​(java.lang.String tag,
                             java.lang.String message)
        Warning Bugfender log method.
        Parameters:
        tag - String with the tag.
        message - String with the message.
      • e

        public static void e​(java.lang.String tag,
                             java.lang.String message)
        Error Bugfender log method.
        Parameters:
        tag - String with the tag.
        message - String with the message.
      • f

        public static void f​(java.lang.String tag,
                             java.lang.String message)
        Fatal Bugfender log method.
        Parameters:
        tag - String with the tag.
        message - String with the message.
      • log

        public static void log​(int lineNumber,
                               java.lang.String method,
                               java.lang.String file,
                               LogLevel logLevel,
                               java.lang.String tag,
                               java.lang.String message)
        Bugfender interface for logging, which takes a simple string as log message.
        Parameters:
        lineNumber - The line number of the log.
        method - The method where the log has happened.
        file - The file where the log has happened.
        logLevel - Log level.
        tag - Tag to be applied to the log line.
        message - Message to be logged. The message will be logged verbatim, no interpretation will be performed.
      • sendIssue

        public static java.net.URL sendIssue​(java.lang.String title,
                                             java.lang.String text)
        Sends an issue
        Parameters:
        title - Short description of the issue.
        text - Full details of the issue. Markdown format is accepted.
        Returns:
        The URL pointing to the issue on the Bugfender dashboard or null if SDK is not initialized.
      • sendUserFeedback

        public static java.net.URL sendUserFeedback​(java.lang.String title,
                                                    java.lang.String message)
        Sends user feedback
        Parameters:
        title - Title for the feedback.
        message - Feedback message. Markdown format is accepted
        Returns:
        The URL pointing to the feedback information on the Bugfender dashboard or null if SDK is not initialized.
      • sendCrash

        public static java.net.URL sendCrash​(java.lang.String title,
                                             java.lang.String text)
        Send a crash. Useful for controlled Exceptions
        Parameters:
        title - Title for the crash.
        text - Additional info for the crash, p.e. the Stack trace. Markdown format is accepted
        Returns:
        The URL pointing to the crash information on the Bugfender dashboard or null if SDK is not initialized.
      • setForceEnabled

        public static void setForceEnabled​(boolean enabled)
        Synchronizes all logs and issues with the server all the time, regardless if this device is enabled or not.

        Logs and issues are synchronized continuously while forceEnabled is active.

        Parameters:
        enabled - Whether logs and issues should be sent regardless of the Bugfender Console settings.
      • forceSendOnce

        public static void forceSendOnce()
        Synchronizes all logs and issues with the server once, regardless if this device is enabled or not.

        Logs and issues are synchronized only once. After that, the logs are again sent according to the enabled flag in the Bugfender Console.

      • getDeviceUrl

        public static java.net.URL getDeviceUrl()
        Get a URL pointing to the Bugfender dashboard page for the device.
        Returns:
        The URL to the page if the Bugfender sdk is initialized otherwise return null.
      • getSessionUrl

        public static java.net.URL getSessionUrl()
        Get a URL pointing to the Bugfender dashboard page for the device and current session.
        Returns:
        The URL to the page if the Bugfender sdk is initialized otherwise return null.
      • setDeviceBoolean

        public static void setDeviceBoolean​(java.lang.String key,
                                            boolean value)
        Sets a device detail with boolean type.
        Parameters:
        key - key.
        value - A boolean value.
      • setDeviceString

        public static void setDeviceString​(java.lang.String key,
                                           java.lang.String value)
        Sets a device detail with string type.
        Parameters:
        key - key.
        value - A string value.
      • setDeviceInteger

        public static void setDeviceInteger​(java.lang.String key,
                                            java.lang.Integer value)
        Sets a device detail with integer type.
        Parameters:
        key - key.
        value - A integer value.
      • setDeviceFloat

        public static void setDeviceFloat​(java.lang.String key,
                                          java.lang.Float value)
        Sets a device detail with double type.
        Parameters:
        key - key.
        value - A double value.
      • setApiUrl

        public static void setApiUrl​(java.lang.String url)
        Sets the URL of the API

        Usage of this function is not necessary in the general use case. Please use exclusively when directed from technical support. This method must be called before Bugfender.init().

        Parameters:
        url - Custom url.
      • setBaseUrl

        public static void setBaseUrl​(java.lang.String url)
        Sets the URL of the Bugfender Dashboard

        Usage of this function is not necessary in the general use case. Please use exclusively when directed from technical support. This method must be called before Bugfender.init()..

        Parameters:
        url - base URL of the Bugfender's dashboard
      • removeDeviceKey

        public static void removeDeviceKey​(java.lang.String key)
        Remove a device detail.
        Parameters:
        key - key.
      • enableLogcatLogging

        public static void enableLogcatLogging()
        Logs all logs written via Logcat.
      • enableLogcatLogging

        public static void enableLogcatLogging​(LogcatInterceptor logcatInterceptor)
        Logs all logs written via Logcat.
        Parameters:
        logcatInterceptor - Interceptor that allows to modify or block log entries.
      • enableCrashReporting

        public static void enableCrashReporting()
        Enable crash reporting tool functionality
      • disableReflection

        public static void disableReflection​(boolean disable)
        Disable reflection when generation log lines. This will save cpu-cycles but some extra information won't be available like the method name and the line on which the log was generated
        Parameters:
        disable -
      • enableUIEventLogging

        public static void enableUIEventLogging​(android.app.Application application)
        Logs all actions performed and screen changes in the application, such as button touches, etc...
      • overrideDeviceName

        public static void overrideDeviceName​(java.lang.String name)
        Overrides the device name that will be shown in the Dashboard. This method must be called before init(Context, String, boolean) to have effect
        Parameters:
        name - New device name
      • getUserFeedbackActivityIntent

        public static android.content.Intent getUserFeedbackActivityIntent​(android.content.Context context,
                                                                           java.lang.String title,
                                                                           java.lang.String hint,
                                                                           java.lang.String subjectHint,
                                                                           java.lang.String messageHint,
                                                                           java.lang.String sendButtonText)
        Provides an Intent for opening an Activity to gather the feedback of the users and sent it to Bugfender. If the Activity is launched with Activity.startActivityForResult(Intent, int) it will return Activity.RESULT_OK if the user clicked the send button or Activity.RESULT_CANCELED otherwise
        Parameters:
        context - Current activity context
        title - Title for the app bar
        hint - Short text that is shown above the subject and message inputs
        subjectHint - Hint in the subject EditText
        messageHint - Hint in the message EditText
        sendButtonText - Text to show on the button that will send
        Returns:
        The Intent to be used for opening the feedback Activity
      • getUserFeedbackActivityIntent

        public static android.content.Intent getUserFeedbackActivityIntent​(android.content.Context context,
                                                                           java.lang.String title,
                                                                           java.lang.String hint,
                                                                           java.lang.String subjectHint,
                                                                           java.lang.String messageHint,
                                                                           java.lang.String sendButtonText,
                                                                           FeedbackStyle style)
        Provides an Intent for opening an Activity to gather the feedback of the users and sent it to Bugfender. If the Activity is launched with Activity.startActivityForResult(Intent, int) it will return Activity.RESULT_OK if the user clicked the send button or Activity.RESULT_CANCELED otherwise
        Parameters:
        context - Current activity context
        title - Title for the app bar
        hint - Short text that is shown above the subject and message inputs
        subjectHint - Hint in the subject EditText
        messageHint - Hint in the message EditText
        sendButtonText - Text to show on the button that will send
        style - Configuration object containing style customizations
        Returns:
        The Intent to be used for opening the feedback Activity