Tips for working with Android 4.3 (An Even Sweeter Jelly Bean)

1:19 PM , 0 Comments

Welcome to Android 4.3, a sweeter version of Jelly Bean! Android 4.3 includes performance optimizations and great new features for users and developers.

I discuss about few things that can be take in care while running your previously published app on Android 4.3.If you have previously published an app for Android, be aware that your app might be affected by changes in Android 4.3. The new feature called Restricted profiles, a new way to manage users and their capabilities on a single device.

There are many cases where your app can misbehave in restricted profile :
  1. If your app uses implicit intents...

    For example, a restricted profile might have the web browser and camera app disabled. So your app should not make assumptions about which apps are available, because if you call startActivity() without verifying whether an app is available to handle theIntent, your app might crash in a restricted profile.When using an implicit intent, you should always verify that an app is available to handle the intent by callingresolveActivity() or queryIntentActivities(). For example:
    Intent intent = new Intent(Intent.ACTION_SEND);
    if (intent.resolveActivity(getPackageManager()) != null) {
    } else {
        Toast.makeText(context, R.string.app_not_available, Toast.LENGTH_LONG).show();
  2. If your app depends on accounts...
    Any accounts added to the primary user are available to a restricted profile, but the accounts are not accessible from theAccountManager APIs by default.

    Due to these restrictions, you have the following three options:

    • Allow access to the owner’s accounts from a restricted profile.
      To get access to an account from a restricted profile, you must add the android:restrictedAccountType attribute to the <application> tag:
      <application ...
          android:restrictedAccountType="com.example.account.type" >
    • Disable certain functionality when unable to modify accounts.
       If you want to use accounts, but don’t actually require them for your app’s primary functionality, you can check for account availability and disable features when not available.
      UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
      Bundle restrictions = um.getUserRestrictions();
      if (restrictions.getBoolean(UserManager.DISALLOW_MODIFY_ACCOUNTS, false)) {
         // cannot add accounts, disable some functionality

    • Disable your app when unable to access private accounts.
      If it’s instead important that your app not be available to restricted profiles because your app depends on sensitive personal information in an account (and because restricted profiles currently cannot add new accounts), add the android:requiredAccountType attribute to the <application> tag:
      <application ...
          android:requiredAccountType="com.example.account.type" >

  3. Bluetooth Low Energy (Smart Ready)
    You can only scan for Bluetooth LE devices or scan for Classic Bluetooth devices using previous APIs. You cannot scan for both LE and Classic Bluetooth devices at once.

Karn Shah

My name is Karn Shah, I am a software developer living in Ahmedabad,India and my job/hobby is Android. I have been working on the Android platform since 2011 and I hope that sharing what I have learned will help people get proficient in Android faster!