Hi All,

I'm trying to lock the phone screen from a broadcast receiver that
listens for the change from CALL_STATE_OFFHOOK to CALL_STATE_IDLE, and
then locks the screen with a call to the
DevicePolicyManager's .lockNow(). It works fine most of the time
except if the Activity that enables the device manager is ever killed.
The app breaks when it tries to lock the screen, in that case since
the Device Manager is declared in that activity with

mDPM =
(DevicePolicyManager)getSystemService(Context.DEVICE_POLICY_SERVICE);
mAdminName = new ComponentName(this, DeviceAdminReceiver.class);

How can I have that DevicePolicyManager held in that broadcast
receiver so I don't get a null pointer exception?

Any help is appreciated!

Thanks,
Thomas McGinniss

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to