Is it possible to keep track when my Android phone is startup and when it is shutdown?
My standard recommendation again here: Tasker, the most complete automation solution available for Android. Tasker can react on different events and perform tasks when they occur. So you could setup two profiles:


Profile "Startup":

Condition: Device Boot (this is boot_completed))
Task: Write File (with your information specified in the parameters)

Profile "Shutdown":

Condition: Device Shutdown
Task: Write File (with your information specified in the parameters)



For the text you can use Variables like e.g. %DATE. Only difficulty will be to determine whether the shutdown was caused by the user or a program -- no easy recipe here, especially not for un-rooted devices. This information might be extracted from the system logs somehow; but starting with JellyBean, this would require root permissions.