OneSignal / OneSignal-Android-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native Android or Amazon app with OneSignal. https://onesignal.com
Other
604 stars 368 forks source link

Kotlin multiplatform support [Feedback]: #2038

Open salimisler28 opened 6 months ago

salimisler28 commented 6 months ago

What's on your mind?

It would be great to have a SDK for KMP (at least android and iOS targets).. Thank you

Code of Conduct

jkasten2 commented 6 months ago

Thanks for submitting this feature request, is there a specific benefit you are looking for?

I haven't used Kotlin Multiplatform myself but from what read about it you should be able to use this OneSignal-Android-SDK directly, then for iOS you can use the OneSignal-iOS-SDK and import that as well by following Kotlin's iOS import guide: https://kotlinlang.org/docs/multiplatform-ios-dependencies.html

Having to import two libraries in different ways (OneSignal-iOS-SDK & OneSignal-Android-SDK) and use the correct one based on build time or runtime means you will probably want to encapsulate this logic into your own wrapper class. Is this basically what you are looking for to be provided by OneSignal?

salimisler28 commented 6 months ago

Thanks for submitting this feature request, is there a specific benefit you are looking for?

I haven't used Kotlin Multiplatform myself but from what read about it you should be able to use this OneSignal-Android-SDK directly, then for iOS you can use the OneSignal-iOS-SDK and import that as well by following Kotlin's iOS import guide: https://kotlinlang.org/docs/multiplatform-ios-dependencies.html

Having to import two libraries in different ways (OneSignal-iOS-SDK & OneSignal-Android-SDK) and use the correct one based on build time or runtime means you will probably want to encapsulate this logic into your own wrapper class. Is this basically what you are looking for to be provided by OneSignal?

Hello, thanks for your quick response. Maybe my message was not clear, I would like to use some features like adding tags and the others in common part. Otherwise we have to write it separately for Android and iOS.

jkasten2 commented 6 months ago

To set expectations, we don't plan to adding support in the short term, so I think writing your own little wrapper class around OneSignal will be your best bet for now.

As some research in understanding how KMP should work for libraries / SDKs I found a few that already support it:

If anyone has any other guides or documentation how to enable KMP for libraries / SDKs please feel free to share.