If user change the datetime from android phone settings,then it will not provide real time from activity class using java datetime.
So how to get realtime,if user change it from settings.
Get it from Api. There is a lot of time providing Apis. Or use your own Api.
You could use an API to get the result you want.
An example of that would be this API.