Class LicenseUtil


  • public class LicenseUtil
    extends java.lang.Object
    Reads license keys from (in this order): application's manifest, app_data_dir/LICENSE_FILENAME, SHARED_PREFERENCES_FILE_NAME, or BuildConfig.LICENSE_KEY

    Writes license keys to app_data_dir/LICENSE_FILENAME, or SHARED_PREFERENCES_FILE_NAME

    • Constructor Summary

      Constructors 
      Constructor Description
      LicenseUtil()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getLicenseKey​(android.content.Context context)
      Attempt to read the license key from several locations in this order: Application preferences BuildConfig.LICENSE_KEY
      void setLicenseKey​(android.content.Context context, java.lang.String license)
      Writes the provided license to the shared preferences
      • Methods inherited from class java.lang.Object

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

      • LicenseUtil

        public LicenseUtil()
    • Method Detail

      • getLicenseKey

        public java.lang.String getLicenseKey​(android.content.Context context)
        Attempt to read the license key from several locations in this order:
        • Application preferences
        • BuildConfig.LICENSE_KEY
        Parameters:
        context - Current context.
        Returns:
        The license key, empty string if none could be found.
      • setLicenseKey

        public void setLicenseKey​(android.content.Context context,
                                  java.lang.String license)
        Writes the provided license to the shared preferences
        Parameters:
        context - The application's context
        license - The license key to write