You are here: Forum Home → ANT Developers Forums → ANT in Mobile Phones → Thread
getSystemService(Context.BLUETOOTH_SERVICE)
PackageManager.getPackageInfo("com.dynastream.ant.radio.idontknow", ...)
Arrays.asList(packageManager.getSystemSharedLibraryNames()).contains(com.dsi.ant.antradio_library)
packageManager.queryIntentServices(new Intent(com.dsi.ant.intent.request.SERVICE_INFO), PackageManager.GET_META_DATA);
Dynastream Developer
/**
* Detect whether it's worth to use ANT+ services (besides USB OTG Support).
*
* @param context the typical context which is necessary for almost any operation
* @return <tt>true</tt> when ANT has been detected, <tt>false</tt> otherwise
*/
public static boolean isAntPresent(Context context) {
PackageManager packageManager = context.getPackageManager();
// Any certified device with built-in support should have the antradio-library
// installed in the firmware
boolean containsAntRadioLibrary = Arrays.asList(packageManager.getSystemSharedLibraryNames())
.contains("com.dsi.ant.antradio_library");
if (containsAntRadioLibrary) {
Log.d(TAG, "device contains antradio_library");
return true;
}
// Otherwise, if the manufacturer didn't include the library or the user is using an
// external adapter like a USB stick, you have to query for available ANT services with
List<ResolveInfo> resolveInfos = packageManager.queryIntentServices(
new Intent("com.dsi.ant.intent.request.SERVICE_INFO"), PackageManager.GET_META_DATA);
if (resolveInfos != null && resolveInfos.size() > 0) {
Log.d(TAG, "device might have ANT services installed");
return true;
}
Log.d(TAG, "device does NOT support ANT");
return false;
}
* Any certified device with built-in support should have the antradio-library installed in the firmware: you can check for this withArrays.asList(packageManager.getSystemSharedLibraryNames()).contains(com.dsi.ant.antradio_library)
In the end, if you can install it, or if it is already installed I think the easiest approach is to use the ANT Radio Service to query for adapters or channels and watch for 'adapters not available' result.
AntPluginPcc.getInstalledPluginsVersionNumber