Skip to content

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Xamarin app with OneSignal. https://onesignal.com

License

Notifications You must be signed in to change notification settings

ArgusMagnus/OneSignal-Xamarin-SDK

 
 

Repository files navigation

NuGet

OneSignal Xamarin Push Notification Plugin

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Xamarin application with OneSignal.

Setup

Sample


  • Open Example.Shared.Application in Xamarin.
  • In the Android project's AndroidManifest.xml,
    • Replace EDIT_APPID_TO_TEST_THIS_APP with your OneSignal Application ID.
    • Replace EDIT_GPN_TO_TEST_THIS_APP with your Google Project Number.
  • In the iOS project's Info.plist replace EDIT_APPID_TO_TEST_THIS_APP with your OneSignal Application ID.
  • Build and deploy applications to your devices and send a test notification via the OneSignal dashboard.

Building the project:

Building the OneSignal Xamarin.Android Binding

  1. Clone OneSignal-Android-SDK.
  2. Build the Android SDK Framework using
gradle assemble
  1. Import onesignal-main.aar from there into OneSignal.Android.Binding's Jars folder.
  2. Build the binding!
  3. Import the resultant binding OneSignal.Android.Binding.dll in your Xamarin.Android application.

Building the OneSignal Xamarin.iOS Binding

  1. Clone OneSignal-iOS-SDK.
  2. Build the iOS SDK Framework in Xcode.
  3. Using the Objective Sharpie tool, generate ApiDefinitions.cs and StructAndEnums.cs targetting iPhone OS 9.2.
sharpie bind -framework iOS_SDK/Framework/OneSignal.framework -sdk iphoneos9.2 -namespace Com.OneSignal.iOS
  1. Add the generated ApiDefinitions.cs, StructAndEnums.cs, and the OneSignal library (from iOS_SDK/Framework/OneSignal.framework/Versions/A/OneSignal) into the OneSignal.iOS.Binding.
  2. Rename the OneSignal library to OneSignal.a to clearly denote it as a static library.
  3. In ApiDefinitions.cs, make the following changes:
  • Remove using OneSignal;
  • Remove all Verify references.
  • Change ONE_S_LOG_LEVEL references to OneSLogLevel.
  1. In OneSignal.linkwith.cs, change [assembly: LinkWith ("OneSignal.a", SmartLink = true, ForceLoad = true)] to [assembly: LinkWith ("OneSignal.a", SmartLink = true, ForceLoad = true, Frameworks="SystemConfiguration", LinkerFlags="-ObjC")].
  2. In StructAndEnums.cs, change nuint to ulong.
  3. Build the binding!
  4. Import the resultant binding OneSignal.iOS.Binding.dll in your Xamarin.iOS application.

Contributing

If you would like to contribute to this project, fork this repository and send over a pull request!

License

MIT Licence

About

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Xamarin app with OneSignal. https://onesignal.com

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%