Home > Mobile >  Android development, how to periodically perform an operation
Android development, how to periodically perform an operation

Time:09-17

In the search on the net, most of the operating cycle operation is aimed at a few seconds, I want to achieve a week, half a month or a month of periodic operation, the great god, please have any Suggestions?

CodePudding user response:

You don't have to do is change flow to seconds

CodePudding user response:

General periodic time in milliseconds, so to do what you say cycle operation can replace you: such as: a week 7 * 24 * 60 * 60 * 1000, half month 15 * 24 * 60 * 60 * 1000, a month 30 * 24 * 60 * 60 * 1000

CodePudding user response:

Upstairs is serious, the app out to do,
Every time I think should be record the start time of the time, every time in the application to calculate whether a to a week, half a month, if to perform operations, and to record the next execution time, there is also a kind of way is to set the system clock, could receive radio at any given time

CodePudding user response:

You can write the database into for the first time the beginning of the cycle time, where is the second time we want to use in that read, think what cycle, than time is not ok,

CodePudding user response:

Write_BUG small expert reference 4 floor response:
you can write the database first into the beginning of the cycle time, where is the second time we want to use in that read, think what cycle, than time is not ok,

Do you mean
Into the app for the first time, the time saving to the database
When a second time into, take time to compare the current time and database

CodePudding user response:

reference 5 floor MrSmile1234 reply:
Quote: refer to 4th floor Write_BUG small expert replies:
you can write the database first into the beginning of the cycle time, where is the second time we want to use in that read, think what cycle, than time is not ok,

Do you mean
Into the app for the first time, the time saving to the database
The into the second time, compare with the current time and the database time!
yeah, just be the cycle than do you want to operation, the operation is performed to the data again inventory execution time covering the last remaining for the first time, next time you come in to do the same operation

CodePudding user response:

Handed down from you to the first this time, no. 4.9, 4.16, 4.23, specifically, then execute the program when I was a service to monitor the current time, to do anything she likes

CodePudding user response:

Stored directly milliseconds, each time you open app comparison at a time

CodePudding user response:

refer to 6th floor Write_BUG small expert replies:
Quote: refer to the fifth floor MrSmile1234 reply:

Quote: refer to 4th floor Write_BUG small expert replies:
you can write the database first into the beginning of the cycle time, where is the second time we want to use in that read, think what cycle, than time is not ok,

Do you mean
Into the app for the first time, the time saving to the database
The into the second time, compare with the current time and the database time!
yeah, just be the cycle than do you want to operation, the operation is performed to the data again inventory execution time covering the last remaining for the first time, next time you come in to do the same operations

Hello, so cycle is not very accurate, such as some users open the app today, the next opening may be a week later, it could also be half a month later

CodePudding user response:

reference lead son, 7 floor response:
handed down from you to the first this time, no. 4.9, 4.16, 4.23, specifically, then execute the program when I was a service to monitor the current time, to do anything she likes

Hello, you said a service when the execution of the program, is not very understanding, is the time to open the app still?

CodePudding user response:

I think poor design date in the days to a desired refresh to get value, record again

CodePudding user response:

references 9 f MrSmile1234 response:
Quote: refer to the sixth floor Write_BUG small expert replies:
Quote: refer to fifth floor MrSmile1234 response:

Quote: refer to 4th floor Write_BUG small expert replies:
you can write the database first into the beginning of the cycle time, where is the second time we want to use in that read, think what cycle, than time is not ok,

Do you mean
Into the app for the first time, the time saving to the database
The into the second time, compare with the current time and the database time!
yeah, just be the cycle than do you want to operation, the operation is performed to the data again inventory execution time covering the last remaining for the first time, next time you come in to do the same operations

Hello, so cycle is not very accurate, such as some users open the app today, the next opening may be a week later, it could also be half a month later
why? Your local data inventory accurate open last time, as long as the app don't delete this value in all the time, the next time you when open the calculation time, the time is greater than or equal to do cycle operating cycle

CodePudding user response:

refer to 12 floor Write_BUG small expert replies:
Quote: references 9 f MrSmile1234 response:

Quote: refer to the sixth floor Write_BUG small expert replies:
Quote: refer to the fifth floor MrSmile1234 reply:

Quote: refer to 4th floor Write_BUG small expert replies:
you can write the database first into the beginning of the cycle time, where is the second time we want to use in that read, think what cycle, than time is not ok,

Do you mean
Into the app for the first time, the time saving to the database
The into the second time, compare with the current time and the database time!
yeah, just be the cycle than do you want to operation, the operation is performed to the data again inventory execution time covering the last remaining for the first time, next time you come in to do the same operations

Hello, so cycle is not very accurate, such as some users open the app today, the next opening may be a week later, it could also be half a month later
why? Your local data inventory accurate open last time, as long as the app don't delete this value in all the time, the next time you when open the calculation time, the time is greater than or equal to can't you do cycle operating cycle

Can, before I always consider is in the correct time nodes perform an operation, so consider a bit more, combining the actual demand of the title, found that less strict requirements for cycle, perform can be greater than or equal to cycle,
Thank you so much!
  • Related