I have made a on demand truck booking portal. The functionality are:
- Customer book a vehicle as per his choice.
- After entering proper details the booking is inserted in database.
- According to customers pickup location the notification to driver are send via firebase on android application within the radius of 3kms.
My problem
I want to send notification to drivers which are in 3kms of radius and wait for 30sec for driver to accept booking. If none of the driver within 3kms accept the booking after 30 secs, then again I want to send notification to drivers which are within 3kms and 5kms, and check if booking is accepted by driver after 30 secs. if none of the driver accepts booking than I will shoot SMS to customer that your booking is not accepted.
what should I use to provide the above functionality? I have search on internet and I have found about CRON JOB...which is based on particular time of the day. but I want to execute a function after every booking is inserted in database and check it..