Update widget data - update time

Asked

Viewed 173 times

1

I am creating an application that will have a widget, it will be presented some data taken from a webservice. I need it to update every 5 minutes to have a recent user information.

The documentation of Appwidgetprovider says that update requests will be made only over 30 min, nothing below that, to save battery and unnecessary use.

I have been researching, and in the stack in English, is quoted a solution using Alarmmanager to resolve.

I don’t know the best way to treat this and if there is any way to update in shorter times.

1 answer

2


To solution found of AlarmManager not to be ignored. The benefits of this approach is the possibility to configure the update time, and also handle the device case "sleep". But one has to wonder if it is really necessary that the update time is different from the suggestion that includes documentation. Nowadays we still have this battery problem, in which a device, even in standby, consumes a considerable amount of cargo.

Release many updates to widgets ends up becoming a threat to your app, for in case he are not among the most useful ones installed on the device, the user can come to undo his application by uninstalling it. It is really necessary to reassess this issue in relation to the need.

  • 1

    Thanks for the @acklay reply, my application would need to refresh in shorter times as it would update data from the stock exchange. At the moment I will see the solution with Alarmmanager and think of another way to solve it.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.