I need to get the current time for my android app. The time should be operator\'s time and not the local time set by the user.
TelephonyManager telephonyMan
The simple answer is that it cannot be done. In order to accomplish what you want, your app would need to do two things:
Both of these operations require system-level privileges. That is, your app needs to be signed with a system key (i.e. one issued by Google to device manufacturers) in order to access these functions.
What you can do is get the current time from an NTP server. There are plenty free-to-use NTP servers on the internet. A sample code to get such time is this:
String timeServer = "0.pool.ntp.org";
NTPUDPClient timeClient = new NTPUDPClient();
InetAddress inetAddress = InetAddress.getByName(timeServer);
TimeInfo timeInfo = timeClient.getTime(inetAddress);
long returnTime = timeInfo.getReturnTime();
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(returnTime);
Now your cal
object contains the real time from the NTP server and not the time from the device. Still, you will not be able to set the time as the device's current time.