Java Code Examples for com.google.firebase.database.FirebaseDatabase#getSdkVersion()

The following examples show how to use com.google.firebase.database.FirebaseDatabase#getSdkVersion() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultRunLoop.java    From firebase-android-sdk with Apache License 2.0 6 votes vote down vote up
public static String messageForException(Throwable t) {
  if (t instanceof OutOfMemoryError) {
    return "Firebase Database encountered an OutOfMemoryError. You may need to reduce the"
        + " amount of data you are syncing to the client (e.g. by using queries or syncing"
        + " a deeper path). See "
        + "https://firebase.google.com/docs/database/ios/structure-data#best_practices_for_data_structure"
        + " and "
        + "https://firebase.google.com/docs/database/android/retrieve-data#filtering_data";
  } else if (t instanceof NoClassDefFoundError) {
    return "A symbol that the Firebase Database SDK depends on failed to load. This usually "
        + "indicates that your project includes an incompatible version of another Firebase "
        + "dependency. If updating your dependencies to the latest version does not resolve "
        + "this issue, please file a report at https://github.com/firebase/firebase-android-sdk";
  } else if (t instanceof DatabaseException) {
    // Exception should be self-explanatory and they shouldn't contact support.
    return "";
  } else {
    return "Uncaught exception in Firebase Database runloop ("
        + FirebaseDatabase.getSdkVersion()
        + "). If you are not already on the latest version of the Firebase SDKs, try updating "
        + "your dependencies. Should this problem persist, please file a report at "
        + "https://github.com/firebase/firebase-android-sdk";
  }
}
 
Example 2
Source File: DefaultRunLoop.java    From firebase-admin-java with Apache License 2.0 6 votes vote down vote up
public static String messageForException(Throwable t) {
  if (t instanceof OutOfMemoryError) {
    return "Firebase Database encountered an OutOfMemoryError. You may need to reduce the"
        + " amount of data you are syncing to the client (e.g. by using queries or syncing"
        + " a deeper path). See "
        + "https://firebase.google"
        + ".com/docs/database/ios/structure-data#best_practices_for_data_structure"
        + " and "
        + "https://firebase.google.com/docs/database/android/retrieve-data#filtering_data";
  } else if (t instanceof DatabaseException) {
    // Exception should be self-explanatory and they shouldn't contact support.
    return "";
  } else {
    return "Uncaught exception in Firebase Database runloop ("
        + FirebaseDatabase.getSdkVersion()
        + "). Please report to [email protected]";
  }
}
 
Example 3
Source File: JvmPlatformTest.java    From firebase-admin-java with Apache License 2.0 6 votes vote down vote up
@Test
public void sdkVersionIsWellFormed() {
  // Version number gets filled in during the release process.
  // Having a test case makes sure there are no mishaps.
  final String snapshot = "-SNAPSHOT";
  String sdkVersion = FirebaseDatabase.getSdkVersion();
  if (sdkVersion.endsWith(snapshot)) {
    sdkVersion = sdkVersion.substring(0, sdkVersion.length() - snapshot.length());
  }
  String[] segments = sdkVersion.split("\\.");
  Assert.assertEquals(3, segments.length);
  for (String segment : segments) {
    try {
      Integer.parseInt(segment);
    } catch (NumberFormatException e) {
      Assert.fail("Invalid version number string: " + sdkVersion);
    }
  }
}
 
Example 4
Source File: Context.java    From firebase-android-sdk with Apache License 2.0 5 votes vote down vote up
public ConnectionContext getConnectionContext() {
  return new ConnectionContext(
      this.getLogger(),
      wrapAuthTokenProvider(this.getAuthTokenProvider(), this.getExecutorService()),
      this.getExecutorService(),
      this.isPersistenceEnabled(),
      FirebaseDatabase.getSdkVersion(),
      this.getUserAgent(),
      firebaseApp.getOptions().getApplicationId(),
      this.getSSLCacheDirectory().getAbsolutePath());
}
 
Example 5
Source File: Context.java    From firebase-admin-java with Apache License 2.0 5 votes vote down vote up
public ConnectionContext getConnectionContext() {
  return new ConnectionContext(
      wrapAuthTokenProvider(this.getAuthTokenProvider()),
      this.getExecutorService(),
      this.isPersistenceEnabled(),
      FirebaseDatabase.getSdkVersion(),
      this.getUserAgent(),
      ImplFirebaseTrampolines.getThreadFactory(firebaseApp));
}
 
Example 6
Source File: AndroidPlatform.java    From firebase-android-sdk with Apache License 2.0 4 votes vote down vote up
@Override
public String getPlatformVersion() {
  return "android-" + FirebaseDatabase.getSdkVersion();
}
 
Example 7
Source File: JvmPlatform.java    From firebase-admin-java with Apache License 2.0 4 votes vote down vote up
@Override
public String getPlatformVersion() {
  return "jvm-" + FirebaseDatabase.getSdkVersion();
}