0

I have a Xamarin Forms application where I need to check the Automatic date and time setting value in both Android and iOS devices. For Android I used the below code and getting the value based on the setting.

android.provider.Settings.Global.getInt(getContentResolver(),android.provider.Settings.Global.AUTO_TIME, 0);

However for Xamarin.iOS, I did not find any code to achieve this. Please help me.

hashimks
  • 1,205
  • 2
  • 11
  • 29
  • There is no such an API or permission in iOS . By the way , why did you want to check this status ? – Lucas Zhang Nov 09 '20 at 12:52
  • @LucasZhang-MSFT My application is an offline application which does some process. So I need to get the correct time any operation is done. If the date time setting is automatic, it is correct. Else, anyone can change the date time and wrong time is passed. Here i wanted to restrict doing any operation if this setting is disabled. – hashimks Nov 09 '20 at 13:31
  • In iOS we could not set the system time with code because of security policy . – Lucas Zhang Nov 09 '20 at 13:34
  • @LucasZhang-MSFT Can u pls help me for a better solution? – hashimks Nov 09 '20 at 13:39
  • As I said , we could not implement it in iOS . As a workaround , you could open system setting in iOS . – Lucas Zhang Nov 11 '20 at 06:37
  • Check https://stackoverflow.com/questions/22107315/how-to-programmatically-set-ios-device-time – Lucas Zhang Nov 11 '20 at 06:39

0 Answers0