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. Android canvas setMatrix(null) crashes (if preceded by a getMatrix)

In the lunar lander example, if I add the following two lines to the
top of the doDraw method, the app crashes immediately on the second
line with a NullPointerException:



Matrix m = canvas.getMatrix();
canvas.setMatrix( null );



Stack trace is:

FATAL EXCEPTION: Thread-8
java.lang.NullPointerException
    at android.graphics.Matrix.preConcat(Matrix.java:233)
    at android.view.Surface$CompatibleCanvas.setMatrix(Surface.java:
259)
    at com.example.android.lunarlander.LunarView
$LunarThread.doDraw(LunarView.java:617)
    at com.example.android.lunarlander.LunarView
$LunarThread.run(LunarView.java:360)




The canvas documentation for setMatrix states that "If the matrix
parameter is null, then the current matrix is reset to identity", so
there's no reason this should crash.

Also, if I do *not* call getMatrix before calling setMatrix(null),
then setMatrix(null) is *successful*.  So somehow it is the
combination of the two calls that causes the problem.

Can anyone help me figure out what's going on here?

Thanks!

-- 

2. onCellLocationChanged() not called

Hi,

I am currently building an app to record some 3G signal properties
like signal signal strength, cell ID and neigboring cells.

To record the current cell ID, I have registered for the
onCellLocationChanged() callback. (As I understand it, there is no way
to poll for the current cell ID). However, when I tested it out, the
callback is received only immediately after I start the app. Even
after I have traveled for around 30 mins, by which time I am pretty
sure I would have changed at least one cell, the app did not receive
any call backs.

I have also confirmed that data communication happens throughout the
drive. (By making it ping a public server)

In case there were any bugs in my app, I checked it out by forcing
Google Maps to use 'Wireless Networks' instead of GPS satellites. I
found my location hasn't changed since my starting point.

However, once I restarted my phone, Google Maps detected my new location.

Is anyone aware of this error? And does anyone have any solution? The
following are the specs:

Phone: Samsung Galaxy S (GT-I9000)
Firmware version: 2.1

--
Immanuel

-- 

3. SoftKeyboard

4. InstrumentationTestCase: Scrolling a listview to be able to click info icon associated with each item on the list

5. Bad sound quality when recording/playing sounds...

6. Buffering problem while reading an h264 video (using HTTP protocol).

7. Yahoo Mail Setting for your Mobile