Hello, I am working on a KMM library which require...
# multiplatform
Hello, I am working on a KMM library which requires me to get these values from iOS and Android Devices.  • appVersion • connection type: Wifi or cellular • Carrier • Os version • Device model What will be the best way to approach this? Should I ask them at the time of initialization in the Apps or is there another way to get them internally from the KMM project? Happy to elaborate more if this does not make sense.
seems a little vague of a question. you could fetch all this information lazily when it is requested if you want
Sorry, I should have put more effort in framing it well. What I mean is how can I get these values in a kotlin multi platform project? For instance if I need this data from iOS device , how can I get it in iOS main? Do I need to pass something from iOS app?
i can't say for the specifics, but research how to do this from objective-c, and the same principles will apply from your ios kotlin module
🙏 1
@Amritansh i think it's platform specific values, you have to use expect-actual feature of KMP in this case. In actual you will implement functions that provide needed values from each platform. https://kotlinlang.org/docs/reference/mpp-connect-to-apis.html
👍 1
You would need to use expect actual feature , most of this data on iOS is provided by
thanks, that makes sense
@Santiago Avila,
returns only
when running on a physical iPhone device. Do you know any other solution?