Search code examples
javaandroidcyanogenmod

How can I trigger an event when the device's profile is changed?


I'd like to trigger an event when the user changes the phone's profile but I'm not sure how. Idealy, I could catch the a broadcast intent and know when the profile has changed but I haven't been able to find any documentation on this.

If I'm correct, the profile system is not a part of the stock AOSP but Cyanogenmod.

I've trudged through the only two profile-related classes I could find:

The only broadcast intent that I could find was here.

Any idea on how this could be accomplished? My application only targets devices running Cyanogenmod 10.1. This is the profile manager from CyanogenMod to give you a clearer idea of what I'm talking about.

enter image description here


Solution

  • As per my discussions with the Cyanogenmod developers, it can be handled by added a BroadcastReceiver for the Intent in ProfileManagerService.java

    The issue was that this intent was missing from the ProfileManager.java class and instead existed elsewhere.

    The issue for this question can be found on Cyanogenmod's issue tracker.