Search code examples
xamarin-zebble

Can I use Zebble for only UI and use Xamarin for everything else


I would like to use Zebble only for producing UI and all other things I would like to use Xamarin apis/custom http apis/local db or whatever it may be. Basically a UI project with zebble and other things will be in PCLs.

Will it be compatible? Could you please advice?


Solution

  • Yes you can. There is nothing in Zebble that prevents you from using the native APIs directly.

    For custom http calls, I recommend using the HttpClient class which is by default available in all 3 platforms of a newly created Zebble project.

    For Device APIs, you can of course use the standard API classes of each platform, but to save time and achieve 100% code reuse I strongly recommend using the http://zebble.net/docs/device-api. For example if you want o use the lamp (aka flash, led or torch) you can very easily implement that on all platforms with very little code code:

    // Determines if a lamp feature is available on the device.
    if (await Device.Torch.IsAvailable()) { ... }
    
    // This will switch the lamp on.
    await Device.Torch.TurnOn(); 
    
    // This will switch the lamp off.
    await Device.Torch.TurnOff();