Even if you set your project's updatePeriodMillis to less than 30 minutes, you widget will still only update once every half an hour.ĭeciding how frequently your widget should update is never straightforward. When creating this kind of automatic update schedule, 1800000 milliseconds (30 minutes) is the smallest interval you can use. Since it’s the easiest method to implement, I’m going to start by updating our widget automatically, after a set period of time has elapsed. This gives us the finished layout: Updating Your Widget Based on a Schedule The looks different from your typical string, as it’s just a placeholder that’ll be replaced at runtime. Next, define the new string resources that we reference in our layout: Tap to update Add the TextView that’ll display the time of the last update// Add a TextView that’ll display our ‘Last Update’ label// While we’re working on the new_app_widget.xml file, I’m also going to add the TextView that’ll eventually allow the user to trigger an update manually: A TextView that will display the time of the last update. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |