addPersistent preferredActivity上api21 [英] addPersistentPreferredActivity on api21

查看:784
本文介绍了addPersistent preferredActivity上api21的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想保留的活动添加到意图过滤器,我是业主的个人资料和设备所有者,这是检验我有没有安全例外,但仍然是我的行为是不中断通话,不知道下一步该怎么做.. 。帮助请

I'm trying to add persisted activity to intent filter, I am profile owner and device owner and this is verified and I have no security exception but still my activity is not interrupting the call, not sure what to do next ...help please

 if (!devicePolicyManager.isProfileOwnerApp(getApplicationContext().getPackageName())) {
          //error
        } else {

                devicePolicyManager.clearPackagePersistentPreferredActivities(new ComponentName(getApplicationContext(),EnforcerDeviceAdminReceiver.class),getPackageName());


                IntentFilter intentFilter= new IntentFilter(INTENT_ACTION);
                intentFilter.addCategory(Intent.CATEGORY_DEFAULT);

                devicePolicyManager.addPersistentPreferredActivity(new ComponentName(getApplicationContext(),EnforcerDeviceAdminReceiver.class),intentFilter, new ComponentName(getApplicationContext(),
                        HandlerActivity.class));

                               }

添加此我下水后 startActivity(新意图(INTENT_ACTION)); 从其他应用程序,但这不是由上述活动中断

after adding this I am launching startActivity(new Intent(INTENT_ACTION)); from other application but this is not interrupted by the above activity.

推荐答案

我试了几件事情,而不能让它工作。

I've tried several things without being able to make it works.

但是,源$ C ​​$ C似乎做什么的文件说,所以我想该功能目前破(安卓5.0)。

However, the source code seems to do what the documentation say, so I guess the feature is currently broken (Android 5.0).

这篇关于addPersistent preferredActivity上api21的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆