Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon What are the differences between integrating Pushwoosh on Android and iOS in MvvmCross


What are the differences between integrating Pushwoosh on Android and iOS in MvvmCross


Integrating Pushwoosh into mobile applications using MvvmCross involves different steps for Android and iOS due to platform-specific requirements. Here's a detailed overview of the differences:

Android Integration

Prerequisites

To integrate Pushwoosh on Android, you need to set up Firebase Cloud Messaging (FCM) first. This involves connecting your Android project to Firebase through Android Studio and adding the necessary dependencies to your `build.gradle` files[1].

Integration Steps

1. Add Pushwoosh SDK: Include the Pushwoosh library dependency in your `build.gradle` file. Ensure you use the latest version of the Pushwoosh Android SDK[1].
2. Metadata in AndroidManifest.xml: Add metadata tags (`com.pushwoosh.appid`, `com.pushwoosh.apitoken`, and `com.pushwoosh.senderid`) to your `AndroidManifest.xml` file. The `senderid` is typically stored in `strings.xml` as `fcm_sender_id`[1].
3. Initialization Code: Register for push notifications by adding initialization code to your application logic. This typically involves calling `registerForPushNotifications` in your app's startup logic[1].
4. MvvmCross Plugin: Use the Pushwoosh plugin for MvvmCross to simplify integration across platforms. This plugin wraps the native Pushwoosh SDK for Android[4].

Troubleshooting

If issues arise, ensure that Firebase is correctly set up and that all necessary metadata is properly configured in `AndroidManifest.xml`. Also, verify that the device is registered for push notifications by checking the Pushwoosh Control Panel[1].

iOS Integration

Prerequisites

For iOS, you need to integrate the Pushwoosh SDK using either Swift Package Manager or CocoaPods. This involves adding the Pushwoosh package to your project dependencies[7].

Integration Steps

1. Capabilities Setup: In your Xcode project, enable the `Push Notifications` and `Background Modes` capabilities. For iOS 15+, also enable `Time Sensitive Notifications` if needed[7].
2. Info.plist Configuration: Add `Pushwoosh_APPID` and `PW_API_TOKEN` keys to your `Info.plist` file with your Pushwoosh Application Code and API Token, respectively[7].
3. Initialization Code: Initialize Pushwoosh in your `AppDelegate` class by calling the necessary setup methods[7].
4. MvvmCross Plugin: The same MvvmCross Pushwoosh plugin used for Android simplifies integration on iOS by wrapping the native iOS SDK[4].

Troubleshooting

Ensure that all capabilities are correctly enabled and that your `Info.plist` contains the required Pushwoosh metadata. Test push notifications by sending them from the Pushwoosh Control Panel[7].

Key Differences

- Platform Setup: Android requires Firebase setup, while iOS needs specific Xcode capabilities enabled.
- Dependency Management: Android uses Gradle, while iOS uses Swift Package Manager or CocoaPods.
- Metadata Configuration: Android uses `AndroidManifest.xml`, while iOS uses `Info.plist`.
- Initialization Logic: Both platforms require initialization code, but the specifics differ due to platform APIs.

Overall, while the MvvmCross plugin simplifies cross-platform integration, each platform has unique setup and configuration requirements.

Citations:
[1] https://docs.pushwoosh.com/developer/pushwoosh-sdk/android-sdk/firebase-integration/integrate-pushwoosh-android-sdk/
[2] https://docs.pushwoosh.com/developer/pushwoosh-sdk/android-sdk/android-faq/
[3] https://docs.pushwoosh.com/product/integrations/amplitude-integration/
[4] https://www.mvvmcross.com/documentation/plugins/3rd-party-plugins
[5] https://stackoverflow.com/questions/20417063/how-to-integrate-pushwoosh-in-lower-version
[6] https://docs.pushwoosh.com/product/content/presets/
[7] https://docs.pushwoosh.com/developer/pushwoosh-sdk/ios-sdk/setting-up-pushwoosh-ios-sdk/basic-integration-guide/
[8] https://www.nuget.org/packages/SoToGo.Plugins.Pushwoosh/
[9] https://stackoverflow.com/questions/30773677/pushwoosh-how-does-it-work