Class DynamicEngineUtils
java.lang.Object
com.pranavpandey.android.dynamic.engine.util.DynamicEngineUtils
Helper class used for the
DynamicEngine
.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ActivityInfo
getActivityInfo
(Context context, ComponentName componentName) Returns activity info from the component name.static DynamicAppInfo
getAppInfoFromPackage
(Context context, String packageName) Load dynamic app info from the package name.static IntentFilter
Returns the intent filter to register the call event.static IntentFilter
Returns the intent filter to register various events.static int
Returns the correct type for the foreground event.static String
getForegroundPackage
(ActivityManager activityManager) Retrieve the foreground package.static String
getForegroundPackage
(UsageStatsManager usageStatsManager, long time, long interval) Retrieve the foreground package.static IntentFilter
Returns the intent filter to register package intent.
-
Field Details
-
ACTION_ON_CALL
Intent action constant for the on call state.- See Also:
-
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 getPackageManager
.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 getPackageManager
.packageName
- The package name to build the dynamic app info.- Returns:
- The dynamic app info from the package name.
-
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
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
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
Retrieve the foreground package.- Parameters:
activityManager
- The activity manager instance.- Returns:
- The foreground package name on API 20 and below.
-