Preventing timer manipulation from end user with android TimerTask and Timer

前端 未结 1 951
孤独总比滥情好
孤独总比滥情好 2021-01-24 01:23

How can one ensure that a task that is supposed to run for x amount of time on an android os be run for that x period without user manipulation of date and time? For example, i

相关标签:
1条回答
  • 2021-01-24 01:57

    Here is flow/algorithm.

    1) You need to store time of timer first initiated some where, probably database and let timer run for 24 hours.
        a) assuming phone not turned off, timer continues
        b) Assuming phone turned off and turned on
            b1) Get initial timer started time from database, then calculate how much time left for 24 hours. 
            b2) Initiate timer again with left time.
    
    0 讨论(0)
提交回复
热议问题