The first thing is to install <?! NugetShield "Shiny" /?> 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.
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" )]
- 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
For example, if you create a new Visual Studio project named MyApp, and in step 3 below you name your Shiny
YourShinyStartup, you would add the following to each head project:
[assembly: Shiny.ShinyApplication( ShinyStartupTypeName = "MyApp.YourShinyStartup", XamarinFormsAppTypeName = "MyApp.App" )]
- In your shared code project, install <?! NugetShield "Shiny" /?>. Create a Shiny startup class as follows:
<?! Startup ?> // 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 <?!/ Startup ?>
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.
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.
For Android, add a reference to the
Mono.Android.Exportassembly to your Android project. Also ensure you are targeting the latest major version of Android See this StackOverflow post for the procedure.
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
- 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.