本文整理匯總了Java中android.content.pm.PackageManager.getServiceInfo方法的典型用法代碼示例。如果您正苦於以下問題:Java PackageManager.getServiceInfo方法的具體用法?Java PackageManager.getServiceInfo怎麽用?Java PackageManager.getServiceInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.content.pm.PackageManager
的用法示例。
在下文中一共展示了PackageManager.getServiceInfo方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getSuppressorCaption
import android.content.pm.PackageManager; //導入方法依賴的package包/類
private String getSuppressorCaption(ComponentName suppressor) {
final PackageManager pm = mContext.getPackageManager();
try {
final ServiceInfo info = pm.getServiceInfo(suppressor, 0);
if (info != null) {
final CharSequence seq = info.loadLabel(pm);
if (seq != null) {
final String str = seq.toString().trim();
if (str.length() > 0) {
return str;
}
}
}
} catch (Throwable e) {
Log.w(TAG, "Error loading suppressor caption", e);
}
return suppressor.getPackageName();
}
示例2: getLabel
import android.content.pm.PackageManager; //導入方法依賴的package包/類
public static Pair<String, String> getLabel(Context context, String comboAsString) {
String recognizer = "[?]";
String language = "[?]";
String[] splits = TextUtils.split(comboAsString, SEPARATOR);
if (splits.length > 0) {
PackageManager pm = context.getPackageManager();
ComponentName recognizerComponentName = ComponentName.unflattenFromString(splits[0]);
if (recognizerComponentName != null) {
try {
ServiceInfo si = pm.getServiceInfo(recognizerComponentName, 0);
recognizer = si.loadLabel(pm).toString();
} catch (PackageManager.NameNotFoundException e) {
// ignored
}
}
}
if (splits.length > 1) {
language = makeLangLabel(splits[1]);
}
return new Pair<>(recognizer, language);
}
開發者ID:vaibhavs4424,項目名稱:AI-Powered-Intelligent-Banking-Platform,代碼行數:22,代碼來源:RecognitionServiceManager.java
示例3: getServiceProcessName
import android.content.pm.PackageManager; //導入方法依賴的package包/類
private static String getServiceProcessName(Context context, Class<? extends Service> serviceClass) {
PackageManager packageManager = context.getPackageManager();
ComponentName component = new ComponentName(context, serviceClass);
ServiceInfo serviceInfo;
try {
serviceInfo = packageManager.getServiceInfo(component, 0);
} catch (Throwable ignored) {
// Service is disabled.
return null;
}
return serviceInfo.processName;
}
示例4: getServiceLabel
import android.content.pm.PackageManager; //導入方法依賴的package包/類
public static String getServiceLabel(Context context, ComponentName recognizerComponentName) {
String recognizer = "[?]";
PackageManager pm = context.getPackageManager();
if (recognizerComponentName != null) {
try {
ServiceInfo si = pm.getServiceInfo(recognizerComponentName, 0);
recognizer = si.loadLabel(pm).toString();
} catch (PackageManager.NameNotFoundException e) {
// ignored
}
}
return recognizer;
}
開發者ID:vaibhavs4424,項目名稱:AI-Powered-Intelligent-Banking-Platform,代碼行數:14,代碼來源:RecognitionServiceManager.java