Refresh is every minute. We didn't get crash report from 2.x users
yet.
Here is the WakefulIntentService I'm using:

public abstract class WakefulIntentService extends IntentService
{
        public static final String LOCK_NAME_STATIC =
"my.app.Service.Static";
        private static PowerManager.WakeLock lockStatic = null;
        private static final String TAG =
WakefulIntentService.class.getName();

        public WakefulIntentService(String name)
        {
                super(name);
        }

        public static void acquireStaticLock(Context context)
        {
                try
                {
                        getLock(context).acquire();
                        LogHelper.i(TAG, "Wake lock acquired");
                }
                catch (Throwable e)
                {
                        LogHelper.e(TAG, "Cannot acquire wake lock", e);
                }
        }

        synchronized private static PowerManager.WakeLock getLock(Context
context)
        {
                if (lockStatic == null)
                {
                        PowerManager mgr =
(PowerManager)context.getSystemService(Context.POWER_SERVICE);
                        lockStatic = 
mgr.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
LOCK_NAME_STATIC);
                        lockStatic.setReferenceCounted(true);
                }
                return(lockStatic);
        }


        /* (non-Javadoc)
         * @see
android.app.IntentService#onHandleIntent(android.content.Intent)
         */
        protected void onHandleIntent(Intent intent)
        {
                CrashReportHandler.getInstance().init(this);
                LogHelper.i(TAG, "Service onHandleIntent started (" + this + ")
("+Thread.currentThread()+") (" + intent + ")");
                try
                {
                        processWakefulWork(intent);
                }
                catch (Throwable e)
                {
                        LogHelper.e(TAG, "Service Cannot perform 
onHandleIntent", e);
                }
                finally
                {
                        try
                        {
                                if (getLock(this).isHeld())
                                {
                                        getLock(this).release();
                                        LogHelper.i(TAG, "Wake lock released");
                                }
                        }
                        catch (Throwable e)
                        {
                                LogHelper.e(TAG, "Cannot release wake lock", e);
                        }
                        LogHelper.i(TAG, "Service onHandleIntent completed (" + 
this + ")
("+Thread.currentThread()+") ");
                }
        }

        public abstract void processWakefulWork(Intent intent);
}


On Mar 20, 12:56 pm, Mark Murphy <[email protected]> wrote:
> Derek wrote:
> > I've implemented it and I got the crash report from the end user. See
> > details below.
> > The error report is VerifyError when the broadcastReceiver tries to
> > start the WakefulIntentService.
> > It happens on Cupcake/Samsumg. I've tested under emulator with 1.5
> > (minSDK=3) and it works perfect.
> > It seems that a WakefulIntentService field or class is not valid. What
> > could be the problem ?
> > The service was working before without extending WakefulIntentService
> > under the same device.
>
> Well, WakefulIntentService has a static data member for a WakeLock, but
> that's about it.
>
> First, make sure you're using a fairly recent version of
> WakefulIntentService -- if you had to override doWakefulWork(), that's
> recent enough.
>
> Also, what period are you using for the AlarmManager? I can try to
> reproduce the problem on other 1.5 equipment I have here in my Secret
> Mountain Lair.
>
> Also also, your earlier post mentioned you were also getting it on 2.1.
> Let me know if you get a crash report for it.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android Training...At Your Office:http://commonsware.com/training

-- 
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

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to