Introduction To Xamarin
Xamarin Features
Xamarin Architecture
Pros and Cons of Xamarin
Xamarin vs React Native
Xamarin.Essentials
- Features
- Connectivity
- Preferences
- Version tracking
Xamarin Project Structure
*MCW : Managed Callable Wrappers
*ACW : Android Callable Wrappers
*MCW : Managed Callable Wrappers
*ACW : Android Callable Wrappers
XAMARIN | REACT NATIVE | |
---|---|---|
Code | C# | JavaScript |
Compilation iOS |
AOT | Interpreter |
Compilation Android |
JIT/AOT | JIT |
Portability | iOS Android Windows Mac OS |
iOS Android |
Code Reuse | Up to 90% of code | Up to 70% of code |
XAMARIN | REACT NATIVE | |
---|---|---|
GitHub Stars | 5k | 69.3k |
Price | Open Source/Visual Studio for commercial use $539 - 2,999 | Open Source |
Community | Large | Large |
Stability | Has some issues with iOS development | Stable and running |
The Connectivity class lets you monitor for changes in the device's network conditions, check the current network access, and how it is currently connected.
using Xamarin.Essentials;
var current = Connectivity.NetworkAccess;
if (current == NetworkAccess.Internet)
{
// Connection to internet is available
}
Network access falls into the following categories:
Internet – Local and internet access.
ConstrainedInternet – Limited internet access. Indicates captive portal connectivity, where local access to a web portal is provided, but access to the Internet requires that specific credentials are provided via a portal.
Local – Local network access only.
None – No connectivity is available.
Unknown – Unable to determine internet connectivity.
The Preferences class helps to store application preferences in a key/value store.
Supported Data Types
using Xamarin.Essentials;
namespace MyIPCS.FL.Core.Preference
{
class XamarinPreferences : IPreferenceDelegate
{
public int Get(string key, int defaultValue)
{
return Preferences.Get(key, defaultValue);
}
public long Get(string key, long defaultValue)
{
return Preferences.Get(key, defaultValue);
}
public string Get(string key, string defaultValue)
{
return Preferences.Get(key, defaultValue);
}.....
The VersionTracking class lets you check the applications version and build numbers along with seeing additional information such as if it is the first time the application launched ever or for the current version, get the previous build information, and more
using Xamarin.Essentials;
VersionTracking.Track();