Search code examples
androideclipseandroid-intentandroid-5.0-lollipopandroid-bundle

Android L inserts unwanted Intent Extras


My app has been chugging along happily on Android Kitkat and below. However I started getting complaints from Android L users that it crashed on their device.

A surprising thing happened while debugging my app on Lollipop. While the debugger was attached to the app (i.e. I ran the app from Eclipse) the app didn't crash.

However when I killed the debugger and ran the app on the emulator, it crashed.

I discovered that Android L was inserting an intent.

I was only checking whether the bundle extra wasn't null. It wasn't, so when I tried to access my intent, the app crashed.

I tried to log that extra and received

{profile:0}

My question is, why does this happen on Android Lollipop? This doesn't happen in any other Android version.


Solution

  • Since Android Lollipop, you can use Managed Profiles for Enterprises.
    So far I didn't find a way of extracting "profile" key name from Android SDK, so I need to hardcode it :(