Tag: xamarin

Xamarin Forms – check if phone is currently connected to Internet or not

Sometimes, you may need to check if your application has internet connection or not. In order to do so, you can use the plugin https://www.nuget.org/packages/Xam.Plugin.Connectivity/ and then using the following method: public async Task HasInternet() {     var canReach = await CrossConnectivity.Current.IsRemoteReachable(“google.com”);     return canReach; }

Remove Entry suggestion from Xaml file xamarin forms

C# “?.” null-conditional , “??” null-coalescing operators

Just start learning something by looking at the example and rewrite it 1. ?. null-conditional operator Example: var Child = grandparent?.parent?.child; if (Child == null) Child = “”; What does this mean? First, “var” is to auto define the type for Child object which has same type of child. Second, the ?. will help you incase a object …

c# – run a code after a time delay

Sometimes, you will need to execute a piece of code after a time delay. To achieve this behaviour, we can have following 2 solutions: Solution 1: – We can use dependency service to implement a native function of delay for each platform (like delay Runnable for Android) Solution 2: – If you want a cross …