本文整理汇总了C++中CJNIList类的典型用法代码示例。如果您正苦于以下问题:C++ CJNIList类的具体用法?C++ CJNIList怎么用?C++ CJNIList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CJNIList类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPackageManager
bool CXBMCApp::ListApplications(vector<androidPackage> *applications)
{
CJNIList<CJNIApplicationInfo> packageList = GetPackageManager().getInstalledApplications(CJNIPackageManager::GET_ACTIVITIES);
int numPackages = packageList.size();
for (int i = 0; i < numPackages; i++)
{
androidPackage newPackage;
newPackage.packageName = packageList.get(i).packageName;
newPackage.packageLabel = GetPackageManager().getApplicationLabel(packageList.get(i)).toString();
CJNIIntent intent = GetPackageManager().getLaunchIntentForPackage(newPackage.packageName);
if (!intent || !intent.hasCategory("android.intent.category.LAUNCHER"))
continue;
applications->push_back(newPackage);
}
return true;
}
示例2: lock
std::vector<androidPackage> CXBMCApp::GetApplications()
{
CSingleLock lock(m_applicationsMutex);
if (m_applications.empty())
{
CJNIList<CJNIApplicationInfo> packageList = GetPackageManager().getInstalledApplications(CJNIPackageManager::GET_ACTIVITIES);
int numPackages = packageList.size();
for (int i = 0; i < numPackages; i++)
{
CJNIIntent intent = GetPackageManager().getLaunchIntentForPackage(packageList.get(i).packageName);
if (!intent && CJNIBuild::SDK_INT >= 21)
intent = GetPackageManager().getLeanbackLaunchIntentForPackage(packageList.get(i).packageName);
if (!intent)
continue;
androidPackage newPackage;
newPackage.packageName = packageList.get(i).packageName;
newPackage.packageLabel = GetPackageManager().getApplicationLabel(packageList.get(i)).toString();
newPackage.icon = packageList.get(i).icon;
m_applications.push_back(newPackage);
}
}
return m_applications;
}
示例3: wifiManager
int CAndroidNetworkManager::FindNetworkId(const std::string& ssid)
{
CJNIWifiManager wifiManager(CJNIContext::getSystemService("wifi"));
if (!wifiManager)
return -1;
CJNIList<CJNIWifiConfiguration> configs = wifiManager.getConfiguredNetworks();
int numConfigs = configs.size();
for (int i = 0; i < numConfigs; i++)
{
CJNIWifiConfiguration config = configs.get(i);
if(config && config.getSSID() == "\"" + ssid + "\"")
{
return config.getnetworkId();
}
}
return -1;
}