Expand Minimize Picture-in-picture Power Device Status Voice Recognition Skip Back Skip Forward Minus Plus Play Search
Documentation
Sidebar

Class AndroidTools

Hierarchy

java.lang.Object

Package
com.smartdevicelink.util

Constructors

AndroidTools()

public AndroidTools()

Methods

isServiceExported( Context context, ComponentName name )

Check to see if a component is exported

public static boolean isServiceExported(Context context,ComponentName name)

Parameters

context
object used to retrieve the package manager
name
of the component in question

getSdlEnabledApps( Context context, String myPackageName )

Get all SDL enabled apps. If the package name is null, it will return all apps. However, if the package name is included, the resulting hash map will not include the app with that package name.

public static java.util.HashMap getSdlEnabledApps(Context context,String myPackageName)

Parameters

context
a context object used to get an instance of the package manager
myPackageName
the package of the requesting app. This should only be included if the app wants to exclude itself from the map

querySdlAppInfo( Context context, java.util.Comparator<com.smartdevicelink.util.SdlAppInfo> comparator )

Finds all SDL apps via their SdlRouterService manifest entry. It will return the metadata associated with that router service.

public static java.util.List querySdlAppInfo(Context context,java.util.Comparator<com.smartdevicelink.util.SdlAppInfo> comparator)

Parameters

context
a context instance to obtain the package manager
comparator
the Comparator to sort the resulting list. If null is supplied, they will be returned as they are from the system

sendExplicitBroadcast( Context context, Intent intent, java.util.List<android.content.pm.ResolveInfo> apps )

Sends the provided intent to the specified destinations making it an explicit intent, rather than an implicit intent. A direct replacement of sendBroadcast(Intent). As of Android 8.0 (API 26+) implicit broadcasts are no longer sent to broadcast receivers that are declared via the AndroidManifest. If no apps are found to receive the intent, this method will send the broadcast implicitly if no list of apps is provided.

public static void sendExplicitBroadcast(Context context,Intent intent,java.util.List<android.content.pm.ResolveInfo> apps)

Parameters

context
intent
- the intent to send explicitly
apps
- the list of apps that this broadcast will be sent to. If null is passed in the intent will be sent to all apps that match the provided intent via a query to the package manager; it will also be sent implicitly to mimic sendBroadcast()'s original functionality.

Inherited Methods

From Class Methods
java.lang.Object getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize
View on GitHub.com
Previous Section Next Section