Class DynamicEngineUtils

java.lang.Object
com.pranavpandey.android.dynamic.engine.util.DynamicEngineUtils

public class DynamicEngineUtils extends Object
Helper class used for the DynamicEngine.
  • Field Details

    • ACTION_ON_CALL

      public static final String ACTION_ON_CALL
      Intent action constant for the on call state.
      See Also:
    • ACTION_CALL_IDLE

      public static final String ACTION_CALL_IDLE
      Intent action constant for the call idle state.
      See Also:
  • Constructor Details

    • DynamicEngineUtils

      public DynamicEngineUtils()
  • Method Details

    • getActivityInfo

      @Nullable public static ActivityInfo getActivityInfo(@NonNull Context context, @Nullable ComponentName componentName)
      Returns activity info from the component name.
      Parameters:
      context - The context to get PackageManager.
      componentName - The component name to be used.
      Returns:
      The activity info from the component name.
    • getAppInfoFromPackage

      @Nullable public static DynamicAppInfo getAppInfoFromPackage(@NonNull Context context, @Nullable String packageName)
      Load dynamic app info from the package name.
      Parameters:
      context - The context to get PackageManager.
      packageName - The package name to build the dynamic app info.
      Returns:
      The dynamic app info from the package name.
    • getEventsIntentFilter

      @NonNull public static IntentFilter getEventsIntentFilter()
      Returns the intent filter to register various events.
      Returns:
      The intent filter to register a broadcast receiver which can listen special actions of the DynamicEngine.
    • getCallIntentFilter

      @NonNull public static IntentFilter getCallIntentFilter()
      Returns the intent filter to register the call event.
      Returns:
      The intent filter to register a broadcast receiver which can listen call events of the DynamicEngine.
    • getPackageIntentFilter

      @NonNull public static IntentFilter getPackageIntentFilter()
      Returns the intent filter to register package intent.
      Returns:
      The intent filter to register a broadcast receiver which can listen package added or removed broadcasts.
    • getForegroundEventType

      public static int getForegroundEventType()
      Returns the correct type for the foreground event.
      Returns:
      The correct type for the foreground event.
      See Also:
    • getForegroundPackage

      @Nullable public static String getForegroundPackage(@Nullable UsageStatsManager usageStatsManager, long time, long interval)
      Retrieve the foreground package.
      Parameters:
      usageStatsManager - The usage stats manager instance.
      time - The start time to get the recent apps.
      interval - The interval for the requested events.
      Returns:
      The foreground package name on API 21 and above.
    • getForegroundPackage

      @Nullable public static String getForegroundPackage(@Nullable ActivityManager activityManager)
      Retrieve the foreground package.
      Parameters:
      activityManager - The activity manager instance.
      Returns:
      The foreground package name on API 20 and below.