OneSignal Help & Documentation

Welcome to the OneSignal New IA developer hub. You'll find comprehensive guides and documentation to help you start working with OneSignal New IA as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    Support

Xamarin SDK Setup

OneSignal Xamarin SDK Reference. Works with iOS and Android (and derivatives like Amazon).

For Developers

Generate Credentials

Before setting up the Xamarin SDK, you must generate the appropriate credentials for the platform(s) you are releasing on:

iOS - Generate an iOS Push Certificate

Android - Generate a Google Server API Key

Amazon - Generate an Amazon API Key


The Xamarin OneSignal SDK works for both Xamarin Forums and Xamarin Single View projects.


Setup SDK

1. Add NuGet Package

1.1 Under your Droid and / or iOS targets right click on Packages then select Add Packages....

1.2 Search for OneSignalSDK and press Add Package.



2. Add Code

Xamarin Forums Project

2.1A Add the following to your App.xaml.cs.

public App()
{
  InitializeComponent();
  MainPage = new OneSignalXamarinForumsExamplePage();

  OneSignal.Current.StartInit("YOUR_ONESIGNAL_APP_ID")
                  .EndInit();
}

Xamarin Single View App

2.1B - Android - Add OneSignal to your MainActivity.cs in your OnCreate method.

protected override void OnCreate(Bundle savedInstanceState)
{
  base.OnCreate(savedInstanceState);
  SetContentView(Resource.Layout.Main);

  OneSignal.Current.StartInit("YOUR_ONESIGNAL_APP_ID")
                  .EndInit();
}

2.1B - iOS - Add OneSignal to your AppDelegate.cs in your FinishedLaunching method.

public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{

  OneSignal.Current.StartInit("YOUR_ONESIGNAL_APP_ID")
                  .EndInit();
  return true;
}


3. Android Setup

3.1 Add the following permissions to AndroidManifest.xml.

<permission android:name="${manifestApplicationId}.permission.C2D_MESSAGE"
            android:protectionLevel="signature" />
<uses-permission android:name="${manifestApplicationId}.permission.C2D_MESSAGE" />

3.2 In your application tag, add the following.

<application ....>

  <receiver android:name="com.onesignal.GcmBroadcastReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >
    <intent-filter>
      <action android:name="com.google.android.c2dm.intent.RECEIVE" />
      <category android:name="${manifestApplicationId}" />
    </intent-filter>
  </receiver>
  
</application>

Make sure to replace all 3 of instances ${manifestApplicationId} with your package name in AndroidManifest.xml.



4. iOS Setup

4.1 In your application's Info.plist, verify your Bundle Identifier matches you App Settings' Bundle ID, Enable Background Modes, allow Remote notifications.


Troubleshooting

If run into any issues please see our Troubleshooting section

Xamarin SDK Setup

OneSignal Xamarin SDK Reference. Works with iOS and Android (and derivatives like Amazon).

For Developers