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. Download new programs and english courses

Download new programs and english courses

http://www.translatorhossam.co.cc/

-- 

2. Cross post WTA: Nexus One

DA,
Penjualan Google Phone (Nexus One) apa memang hanya via web google dan hanya
di beberapa negara aja?
Nah kalo yang jual offline (di toko) itu apa meraka sebelumnya order juga
via website google trus dijual lagi?
Kalo baca di web-nya Google Nexus One ini after sales supportnya di handle
oleh HTC care sebagai manufacturer OEM-nya, apakah HTC care di Indonesia
(Jakarta) terima juga perbaikan atau warranty claim untuk handset ini, atau
harus kirim ke Singapore?
Mohon infonya ya, TIA

==meyNANTO==

-- 
"Indonesian Android Community [id-android]" 

3. Optimizing Image display in ListViews

4. 杩? how to get android version , kernel version and mac address

5. What is the thing which is shown while the image is loaded.

6. OOT: siapa aja?

7. How to test onCreate with saved Bundle?