I am creating an app that checks for user locations every half an hour and updates the location of the user in the local database and then runs CRUD queries based on the use
I think you are looking for something similar to WakefulIntentService. This handles all your cases completely.
You can do your location and db related work inside doWakefulWork() of said implementation.