• Mobile
  • Extensions
  • Releases
  • GitHub
  • Blog
  • Sponsor
Show / Hide Table of Contents
  • Home
  • Quick Start
  • Setup
    • Dependency Injection
    • Startup
    • Static Instances
    • iOS
    • Android
  • Configuration Extensions
  • Jobs
    • Setup
    • Create a Job
    • Querying, Cancelling, and Adhoc
    • Frequently Asked Questions
  • Bluetooth LE Client
    • Setup
    • Scanning
    • Peripheral
    • Best Practices
    • Manged Scanning
    • Managed Peripheral
  • Bluetooth LE Hosting
    • Setup
    • GATT
    • Advertising
  • Geofencing
  • GPS
    • Setup
  • Motion Activity
  • Local Notifications
    • Getting Started
    • Channels
  • Push Notifications
    • Getting Started
    • Native
    • Azure Notification Hubs
    • Firebase Messaging
    • One Signal
  • Beacons
    • Ranging
    • Monitoring (Background)
  • HTTP Transfers
    • Getting Started
    • Advanced
  • Framework
    • Getting Started
    • ViewModel
  • Sensors
    • Getting Started
    • Accelerometer
    • Ambient Light
    • Barometer
    • Compass
    • Gyroscope
    • Humidity
    • Magnetometer
    • Pedometer
    • Proximity
    • Temperature

Quick Start

Setup

  1. The first thing is to install to your application head project (i.e. MyProject.iOS and MyProject.Android). This library contains the Shiny.Core and source generators designed to plugin all of the boilerplate code you'll need.

  2. Add the following in some .cs file in each head project:

// NOTE THE USE OF THE FULL TYPE NAME INCLUDING NAMESPACE
[assembly: Shiny.ShinyApplication(
    ShinyStartupTypeName = "MyProject.ShinyStartupClass",
    XamarinFormsAppTypeName = "MyProject.XamarinFormsAppClass"
)]

where

  • MyProject is your project's root namespace
  • ShinyStartupClass is the name of your Shiny startup class (see next step)
  • XamarinFormsAppClass is the name of your shared project App class (usually App)

For example, if you create a new Visual Studio project named MyApp, and in step 3 below you name your Shiny startup class YourShinyStartup, you would add the following to each head project:

[assembly: Shiny.ShinyApplication(
    ShinyStartupTypeName = "MyApp.YourShinyStartup",
    XamarinFormsAppTypeName = "MyApp.App"
)]
  1. In your shared code project, install . Create a Shiny startup class as follows:

using Microsoft.Extensions.DependencyInjection;
using Shiny;

namespace YourNamespace
{
    public class YourShinyStartup : ShinyStartup
    {
        public override void ConfigureServices(IServiceCollection services, IPlatform platform)
        {
            // this is where you'll load things like BLE, GPS, etc - those are covered in other sections
// things like the jobs, environment, power, are all installed automatically
        }
    }
}

  1. For iOS AppDelegate is marked partial. If you have any methods that Shiny uses already implemented, you'll receive a build warning to manually hook the method.

  2. For Android, Shiny will automatically create the necessary Android application class. For your main activity (or multiple activities), ensure each one is marked as partial. Shiny will again, auto hook the necessary methods.

  3. For Android, add a reference to the Mono.Android.Export assembly to your Android project. Also ensure you are targeting the latest major version of Android See this StackOverflow post for the procedure.

  4. Install any of the service modules Shiny has to offer and register them with your startup. Be sure to follow any special OS setup instructions in each module.


The Shiny source generators also automatically wire the following 3rd party libraries for you:

  • Xamarin Forms
  • Xamarin Forms Maps
  • Xamarin Essentials
  • ACR User Dialogs
  • AIForms Settings View
  • XF Material
  • RG Popups
  • FFImageLoading
  • Microsoft Identity Client (MSAL)

If you have a truly custom application and you have a great deal of code in your AppDelegate or Android classes, you can manually hook Shiny into these methods. Take a look at iOS Setup and Android Setup for how to do this.

  • Improve this Doc
In This Article
Back to top Generated by DocFX