如何管理Android应用程序限制配置文件? [英] How to manage restricted profiles in android app?

查看:1279
本文介绍了如何管理Android应用程序限制配置文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

受限制的资料现在在Android的可从4.3,我才知道,像相机时,Gmail等一些应用程序不能在这些类型的配置文件可用。如何管理我的应用程序,这些类型的条件呢?另外如何在应用产品和受限制的配置文件设置对应于我的应用程序管理?

Restricted profile are now available in android from 4.3, i came to know that some apps like camera, gmail etc are not available in these kind of profiles. How can i manage these type of conditions in my app? Also how to manage in app products and restricted profile settings in corresponding to my app?

推荐答案

由于user370305即使我已经访问过

Thanks user370305 even if i already visited

http://developer.android.com/about/versions/ Android的4.3.html#RestrictedProfiles

我想和改善它的参考

https://www.youtube.com/watch?v=pdUcANNm72o

受限制的配置文件是在安卓果冻豆推出4.3的新功能,使您能够给您的应用程序的用户分享他们的平板电脑时,改进的控制。

Restricted Profiles are a new feature introduced in Android Jelly Bean 4.3 that enables you to give users of your applications improved control when sharing their tablet.

这些受限制的配置文件共享应用程序,谷歌帐户的主要用户帐户,但在有限的manner.They没有得到访问Gmail,播放存储,日历等主要用户可以为每个应用程序的限制。

These Restricted Profiles share apps, google account of primary user account but in a restricted manner.They dont get access to gmail, play store, calender etc. Primary user can select the restrictions for each applications.

的UserManager类扩展为管理这些限制

UserManager Class is extended for managing these restrictions

<一个href="http://developer.android.com/reference/android/os/UserManager.html#getUserRestrictions%28android.os.UserHandle%29"相对=nofollow> UserManager.getUserRestrictions 返回强加给指定的用户的用户范围的限制

UserManager.getUserRestrictions returns the user-wide restrictions imposed on the user specified

<一个href="http://developer.android.com/reference/android/os/UserManager.html#getApplicationRestrictions%28java.lang.String%29"相对=nofollow> UserManager.getApplicationRestrictions 返回一个包含所有已保存的申请限制该用户,对于给定的包名称的包。只有这样包名称的应用程序可以调用此方法。

UserManager.getApplicationRestrictions returns a bundle containing any saved application restrictions for this user, for the given package name. Only an application with this package name can call this method.

如果您需要特定的设置使用此意图过滤器

If you need specific settings use this intent filter

<receiver android:name="GetRestrictionsReceiver">
<intent-filter>
<action android:name="android.intent.action.GET_RESTRICTION_ENTRIES "/>
</intent-filter>
</receiver>

现在实现广播接收器限制条目列表返回类似这样

now implement broadcast receiver with Restriction Entry list returned like this

public  class GetRestrictionsReceiver extends BroadcastReceiver
    {

        @Override
        public void onReceive(Context context, Intent intent) {
            // TODO Auto-generated method stub
            final PendingResult result=goAsync();
            new Thread(){
                public void run(){
                    final Bundle extras=new Bundle();
                    ArrayList<RestrictionEntry> newEntries = initRestricions(context);
                    extras.putParcelableArrayList(Intent.EXTRA_RESTRICTIONS_LIST, newEntries);

                    result.setResult(Activity.RESULT_OK, null, extras);
                    result.finish();
                }

            }.start();

        }


    }

RestrictionEntry

这是选择通过实现处理theACTION_GET_RESTRICTION_ENTRIES行动接收机揭露这种限制,这样做的任何应用程序。然后接收器返回包含所谓的限制的条目,其值是一个ArrayList结果包。

Any application that chooses to expose such restrictions does so by implementing a receiver that handles theACTION_GET_RESTRICTION_ENTRIES action. The receiver then returns a result bundle that contains an entry called "restrictions", whose value is an ArrayList.

有3种限制进入的

  1. 布尔
  2. 单项选择
  3. 多项选择

您可以使用RestrictionEntry不同的方法来设置和获取不同类型的限制。

You can use different methods of RestrictionEntry to set and get different type of restrictions.

要得到一个受限制的配置文件访问的帐户,则必须添加的android

To get access to an account from a restricted profile, you must add the android:restrictedAccountType attribute to the tag:

<application ...
    android:restrictedAccountType="com.example.account.type" >

这篇关于如何管理Android应用程序限制配置文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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