语言

Menu
Sites
Language
System Event SYSTEM_EVENT_BATTERY_LEVEL_STATUS does not trigger

Hi there,

I am implementing a native service application 4.0 and I already successfully subscribed to system events e.g. SYSTEM_EVENT_BATTERY_CHARGER_STATUS.

However I fail to receive SYSTEM_EVENT_BATTERY_LEVEL_STATUS events.

Here are the relevant code snippets:

event_handler_h handler;
int ret = event_add_event_handler(SYSTEM_EVENT_BATTERY_LEVEL_STATUS, subscribe_battery_level_status_callback, NULL, &handler);

event_add_event_handler returns success ( 0 ).

And here is the callback function:

void subscribe_battery_level_status_callback(const char *event_name, bundle *event_data, void *user_data){
    char *value;
    bundle_get_str(event_data, EVENT_KEY_BATTERY_LEVEL_STATUS, &value);
    dlog_print(DLOG_INFO, TAG, "subscribe_battery_level_status_callback, Value: %s", value);
}

Now how I test.  The Smartwatch is at around 95% and I start charging. At 100% I would expect that the event triggers and calls the subscribe_battery_level_status_callback function. However, I don't receive anything.

Any ideas? Your help would be much appreciated!

Cheers Keaselstein

响应

1 回复
Eckhardt

Additional Info:

I just noticed that the callback got called once when it was somewhere under 40% battery level. So I guess the code is right.

Does anyone know the exact % of battery level critical, low, high, full?

cheers Keaselstein