OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Xamarin application with OneSignal.
- See setup documentation for full documentation.
- 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.
- Replace
- In the iOS project's
Info.plist
replaceEDIT_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.
- Clone OneSignal-Android-SDK.
- Build the Android SDK Framework using
gradle assemble
- Import
onesignal-main.aar
from there intoOneSignal.Android.Binding
's Jars folder. - Build the binding!
- Import the resultant binding
OneSignal.Android.Binding.dll
in your Xamarin.Android application.
- Clone OneSignal-iOS-SDK.
- Build the iOS SDK Framework in Xcode.
- Using the Objective Sharpie tool, generate
ApiDefinitions.cs
andStructAndEnums.cs
targetting iPhone OS 9.2.
sharpie bind -framework iOS_SDK/Framework/OneSignal.framework -sdk iphoneos9.2 -namespace Com.OneSignal.iOS
- Add the generated
ApiDefinitions.cs
,StructAndEnums.cs
, and the OneSignal library (fromiOS_SDK/Framework/OneSignal.framework/Versions/A/OneSignal
) into theOneSignal.iOS.Binding
. - Rename the OneSignal library to
OneSignal.a
to clearly denote it as a static library. - In
ApiDefinitions.cs
, make the following changes:
- Remove
using OneSignal;
- Remove all
Verify
references. - Change
ONE_S_LOG_LEVEL
references toOneSLogLevel
.
- 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")]
. - In
StructAndEnums.cs
, changenuint
toulong
. - Build the binding!
- Import the resultant binding
OneSignal.iOS.Binding.dll
in your Xamarin.iOS application.
If you would like to contribute to this project, fork this repository and send over a pull request!