Cannot always launch DevicePolicyManager activity from another activity

by cpphool » Fri, 04 Mar 2011 21:25:36 GMT


Sponsored Links
 Hi,

I have some strange problem. When I try to launch DevicePolicyManager
activity from my main activity, it loads properly. However, when I
make a notification, call QuestionActivity (if user clicks the
notification), and then try to call DevicePolicyManager activity from
QuestionActivity, I get (logcat):

INFO/ActivityManager(104): Starting activity: Intent
{ act=android.app.action.ADD_DEVICE_ADMIN
cmp=com.android.settings/.DeviceAdminAdd (has extras) }
WARN/InputManagerService(104): Window already focused, ignoring focus
gain of: com.android.internal.view.IInputMethodClient$Stub
$Proxy@4514a2d0

And nothing appears. This is strange for me, cause I'm able to launch
different Android OS activity from QuestionActivity:

        //This works
        Intent intent = new Intent(Settings.ACTION_BLUETOOTH_SETTINGS);
        startActivity(intent);

But I cannot launch the DevicePolicyManager with:

        //This works from main activity, but not from QuestionActivity
        MyDeviceAdmin admin = new MyDeviceAdmin(this);
        Intent intent = new
Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
        intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN,
                 admin.getDeviceAdminComponent());
        intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION,
                "Additional text explaining why this needs to be
added.");
        startActivityForResult(intent, 234234234);

I would be very grateful for any help, cause I'm completely stuck.

-- 



Other Threads

1. Looking for information on the Fragment dump() method (FragmentManager too)

Both of these classes have a dump() method which looks useful for
debugging. I tried to use them in a sample application, but I'm not
getting any output at all. My code looks like this from within my
activity:

        public void dumpFragmentMgr() {
                FragmentManager fm = getFragmentManager();
                File dumpFile = new 
File(Environment.getExternalStorageDirectory() +
                        "/fmdump.txt");
                if(dumpFile.exists()) {
                        dumpFile.delete();
                }
                try {
                    FileOutputStream fos = new FileOutputStream(dumpFile, true);
                    fm.dump("DIALOG", fos.getFD(), new PrintWriter(fos),
                                null);
                    fos.flush();
                    fos.close();
                } catch (FileNotFoundException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
        }

I'm positive that I have fragments in my fragment manager. My output
file is always empty, although I can see the datetimestamp getting
updated. I'm always passing null for the 4th argument to dump() since
I have no idea what else to put there. I have enableDebugLogging set
to true. Any help please?

-- 

2. Beta Game Space Bike

here are some download links
check it out.
tell people about it, if you know any reviewers give them a link,
also post problems, bugs, questions, suggestions

http://www.megaupload.com/?d=R02OEBUE
http://rapidshare.com/files/450131198/Space_Bike_Game.zip
http://www.mediafire.com/?qnffd2qb8hrcjah

-- 

3. Clear data from MediaStore

4. Draw Image next to text on canvas

5. Maps not working in the android emulator

6. noob question I guess - input requires enter key

7. Simple Search App -- Help Required