Class Bugfender

java.lang.Object
com.bugfender.sdk.Bugfender

public class Bugfender extends Object
  • Constructor Details

    • Bugfender

      public Bugfender()
  • Method Details

    • init

      public static void init(android.content.Context context, String applicationToken, boolean debug, boolean autoFetchAndroidId)
      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.
      autoFetchAndroidId - Automatically fetch the ANDROID_ID and send it as $android_id key-value. You may need to disable this for some types of apps.
    • init

      public static void init(android.content.Context context, String applicationToken, boolean debug)
      Deprecated.
      Prefer to explicitly state if ANDROID_ID should be sent or not, with init(Context, String, boolean, boolean).
      Initialize the Bugfender SDK with a specific application token. Automatically fetches the ANDROID_ID.
      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(String tag, String message)
      Trace Bugfender log method.
      Parameters:
      tag - String with the tag.
      message - String with the message.
    • i

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

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

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

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

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

      public static void log(int lineNumber, String method, String file, LogLevel logLevel, String tag, 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 URL sendIssue(String title, 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 URL sendUserFeedback(String title, 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 URL sendCrash(String title, 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 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 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(String key, boolean value)
      Sets a device detail with boolean type.
      Parameters:
      key - key.
      value - A boolean value.
    • setDeviceString

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

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

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

      public static void setApiUrl(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(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(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, Object... ignoredViewsTags)
      Logs all actions performed and screen changes in the application, such as button touches, etc...
      Parameters:
      application - Application class
      ignoredViewsTags - Tags of views that should not be observed and logged by Bugfender
    • overrideDeviceName

      public static void overrideDeviceName(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, String title, String hint, String subjectHint, String messageHint, 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, String title, String hint, String subjectHint, String messageHint, 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