Problems writing a C2DM service (InstantiationException).

by Cristian Udrea » Sat, 12 Feb 2011 06:07:38 GMT


Sponsored Links
 Hello everybody.
I'm trying to implement a C2DM service over a barebones "hello world"
application with two buttons.
At first I used a BroadcastReceiver, but it has a 10 second execution
limit and a few other limitations,
so I thought it would be better to use the IntentService approach
(google's C2DM samples).
I picked the crome-to-phone example.

The problem is that  when executing the following lines:

    static void runIntentInService(Context context, Intent intent) {
        if (mWakeLock == null) {
            // This is called from BroadcastReceiver, there is no
init.
            PowerManager pm =
                (PowerManager)
context.getSystemService(Context.POWER_SERVICE);
            mWakeLock =
pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
                    WAKELOCK_KEY);
        }
        mWakeLock.acquire();

        intent.setClassName(context,
"com.example.helloandroidc2dm.C2DMReceiver");
        context.startService(intent); <=== HERE
    }

the JVM throws what seems to be a recursive InstantiationException.

Normally, that would be because of abstract methods, but after
changing the class to no longer
be an abstract class, it still happens.

Does anyone have (at least) a pointer for where I should start
debugging ?

Thanks in advance.

-- 



Other Threads

1. Context menu for other views

Hi friends,
       I have created one music app. In this app, i have loaded albums
dynamically by using URL request and displayed as table layout. For
each table row i registered context menu. But when the context menu is
appeared by long press on each table row i could not find on which
table row the context menu is appeared. If anyone know please guide me
to solve this problem.

Thanks
venu

-- 

2. Change Eclipse Layout Orientation

Hello

I want to know how to change the orientation of my layout inside of eclipse

in my manifest I have

android:screenOrientation="landscape"

in my layout xml I have

android:orientation="horizontal"


but when I click the "layout" button it still shows it as a vertical layout

Thank You

-- 

3. REST php server and android client

4. Select folder intent & Work out when intent complete?

5. How to create multiple View in one screen?

6. query sms from smsinbox

7. How to Read sms from inbox and sent items