-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android N 插件 在获取PackageInfo.activies = null 7.0之前的版本都无此问题 #329
Comments
我是在PluginPackageParser里面的getPackageInfo方法里面在调用generatePackageInfo之前,加以下代码:
|
@VidicLee 你提出的代码中
有一种情况, 我遇到过在 Nexus 5X Android 7.1.1 版本下有一个系统级应用:
里面是没有任何的 Activity 的,可以留意下这种情况。 |
Add flags of PackageManager.MATCH_DIRECT_BOOT_AWARE and PackageManager.MATCH_DIRECT_BOOT_UNAWARE while calling queryIntentActivities. In Android N or later version: |
try {
PackageInfo packageInfo = pm.getPackageInfo(context.getPackageName(), PackageManager.GET_ACTIVITIES);
if(packageInfo.activities==null){
此处为空,找了很久始终没有解决方案
return null;
}
for (ActivityInfo ai : packageInfo.activities) {
if ((name+hideName).equals(ai.nonLocalizedLabel)) {
activityInfo = ai;
break;
}
}
} catch (Exception e) {
e.printStackTrace();
}
The text was updated successfully, but these errors were encountered: