Skip to content
Advertisement

Is there a unique boot session id or count on an android device?

The app I’m writing needs to know if a ‘boot session‘, for want of a better term, has changed but it doesn’t need to actually start at boot and I would prefer if possible not to have to use the RECEIVE_BOOT_COMPLETED permission.

So I was wondering if there is any device-wide boot session id or count I can query and store in my db to check against later. I know I can get the time in milliseconds since boot but I don’t think that will be useful in this case.

Thanks in advance for any help.

Advertisement

Answer

Why not store the (absolute) date and time of the last boot in your database? You can compute it easily using the time since boot, and given that a boot takes much longer than a millisecond it should be fairly accurate.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement