How to manage restricted profiles in android app? -
restricted profile available in android 4.3, came know apps camera, gmail etc not available in these kind of profiles. how can manage these type of conditions in app? how manage in app products , restricted profile settings in corresponding app?
thanks user370305 if visited
http://developer.android.com/about/versions/android-4.3.html#restrictedprofiles
i improve reference
https://www.youtube.com/watch?v=pducannm72o
restricted profiles new feature introduced in android jelly bean 4.3 enables give users of applications improved control when sharing tablet.
these restricted profiles share apps, google account of primary user account in restricted manner.they dont access gmail, play store, calender etc. primary user can select restrictions each applications.
usermanager class extended managing these restrictions
usermanager.getuserrestrictions returns user-wide restrictions imposed on user specified
usermanager.getapplicationrestrictions returns bundle containing saved application restrictions user, given package name. application package name can call method.
if need specific settings use intent filter
<receiver android:name="getrestrictionsreceiver"> <intent-filter> <action android:name="android.intent.action.get_restriction_entries "/> </intent-filter> </receiver>
now implement broadcast receiver restriction entry list returned 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(); } }
any application chooses expose such restrictions implementing receiver handles theaction_get_restriction_entries action. receiver returns result bundle contains entry called "restrictions", value arraylist.
there 3 types of restriction entry
- boolean
- single choice
- multiple choice
you can use different methods of restrictionentry set , different type of restrictions.
to access account restricted profile, must add android:restrictedaccounttype attribute tag:
<application ... android:restrictedaccounttype="com.example.account.type" >
Comments
Post a Comment