Xamarin Library Integration
How to integrate Pushwoosh Xamarin library into your project
1. Change target framework of your Android project to Android 8.0 or higher.
2. Add the Pushwoosh nuget package to both Android and iOS projects.
3. Make the following changes in the AppDelegate.cs of your iOS project:
3.1. In the beginning of the FinishedLaunching
method, put the following line:
3.2. Add these methods to the AppDelegate:
4. In the Info.plist, change the Pushwoosh_APPID value to your Pushwoosh Application Code. You can find it in your Control Panel.
5. Configure your project in Firebase Console.
6.1. Add google-services.json
file to your Android project.
google-services.json
You should've gotten the google-services.json
file while creating the app in Firebase console. If you haven't, please consult this thread (section Get a config file for your Android app).
6.2. In Visual Studio, right-click the google-services.json
and choose GoogleServicesJson option from the Build Action menu.
7. In the MainActivity.cs of your Android project, before defining the namespace, add these lines:
Also, in the beginning of onCreate
method of the MainActivity class, initialize the PushManager with Pushwoosh.Droid.PushManager.Init();
line.
8. In your Android project, find the Resources/values/strings.xml file or create it. Add your Sender ID string there:
9. In the cross-platform part of App.xaml.cs, add the registration to onStart
method:
Geozones Push Notifications
1. To enable location tracking in your application: 1.1. Install the Pushwoosh.Geozones nuget package into your projects.
1.2. For iOS add the following keys to your Info.plist:
NSLocationWhenInUseUsageDescription
– (required) for app to track Geozones only while running in the foreground.NSLocationAlwaysAndWhenInUseUsageDescription
- (required) for app to track Geozones in both conditions, and to show a permission request dialog pop-up.NSLocationAlwaysUsageDescription
– (optional) for app to track Geozones at all times; should be used if your app targets iOS 10 and earlier versions.
1.3. Add the following line to your AppDelegate.cs (after Pushwoosh.iOS.PushManager.Init();
):
1.4. Add the following line to your MainActivity.cs (after Pushwoosh.Droid.PushManager.Init();
):
2. To start location tracking, simply call:
Message Inbox
1. Install the Pushwoosh.Inbox nuget package into your projects.
2.1. For iOS, add the following line to your AppDelegate.cs (after Pushwoosh.iOS.PushManager.Init();
):
2.2. For Android, add the following line to your MainActivity.cs (after Pushwoosh.Droid.PushManager.Init();
):
3. To show the Inbox UI in your app:
3.1. Create the PushwooshInboxStyle instance:
3.2. Then call:
For more details, take a look at Inbox sample https://github.com/Pushwoosh/pushwoosh-xamarin/tree/master/Samples/Forms
Share your feedback with us
Your feedback helps us create a better experience, so we would love to hear from you if you have any issues during the SDK integration process. If you face any difficulties, please do not hesitate to share your thoughts with us via this form.
Last updated