A
A
Artyom2014-02-07 08:50:03
Java
Artyom, 2014-02-07 08:50:03

How to test Alarm Manager on Android?

Using a StackOverflow article , I did something similar for myself, including registering a signal at startup and a service.
The debugger did not enter either the Alarm class, or the Service class, or the BootStart class, even despite the waitForDebugger() line. After some torment, I added a direct call to the service at the start of the initial Activity and somehow still managed to call the service, where I registered signals that fire once a minute.
As a result, something like this appears:

02-06 21:55:47.894      101-116/system_process E/ActivityManager﹕ ANR in com.dracontis.Activities:remote
    Reason: Broadcast of Intent { flg=0x14 cmp=com.dracontis.Activities/com.dracontis.Services.DailyAlarm (has extras) }
    Load: 0.34 / 0.18 / 0.05
    CPU usage from 4960ms to -1792ms ago:
    16% 101/system_server: 10% user + 5.7% kernel / faults: 217 minor
    0.8% 186/com.android.phone: 0.4% user + 0.4% kernel / faults: 23 minor
    0.4% 44/adbd: 0% user + 0.4% kernel
    0.2% 154/com.android.systemui: 0.2% user + 0% kernel / faults: 17 minor
    0.2% 1802/com.dracontis.Activities:remote: 0.2% user + 0% kernel / faults: 60 minor
    0.1% 35/surfaceflinger: 0.1% user + 0% kernel
    0% 675/logcat: 0% user + 0% kernel
    23% TOTAL: 15% user + 8.2% kernel + 0.3% softirq
    CPU usage from 1156ms to 1747ms later:
    8.6% 101/system_server: 1.7% user + 6.8% kernel
    8.6% 116/ActivityManager: 3.4% user + 5.1% kernel
    26% TOTAL: 0% user + 21% kernel + 5.2% softirq

I decided to ask the question anyway, but there could not be a reason that instead of:
<action android:name="android.intent.action.BOOT_COMPLETED"></action>

I use
<action android:name="android.intent.action.BOOT_COMPLETED"/>

Or is the reason something else?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artyom, 2014-02-10
@Dracontis

Yes, in vain I thoughtlessly decided to copy the code. Still, an example is better:
khurramitdeveloper.blogspot.ru/2013/06/android-ala...
After I adjusted it to the application, everything worked. There is an error somewhere on Stackoverflow, and it's easy to get confused in the code layouts.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question