简体   繁体   中英

Access Device and OS information in a Kotlin Multiplatform mobile Project

I am working on a Kotlin Multiplatform Project and I need to access following device data

  • appVersion
  • connection type: Wifi or cellular
  • Carrier
  • Os version
  • Device model

How can I access following data from an iOS as well as Android device in a kotlin multiplatform project?

Can I access them in iOS main and Android main or do I need to pass some reference?

One of the Kotlin Multiplatform's core features is an ability to utilize platform-specific APIs. See an explanation and examples here . I would recommend you to go through the Web and search for a way people get this data on Android or iOS natively, and then re-implement those approaches in your project - Android main contents won't take a lot of time to be adjusted. iOS one might be a little more complicated, but all Apple's frameworks should be accessible as platform.<FrameworkName> and their usage won't be too different from Objective-C's one. For the app version, to begin with, I think those pieces of advice would be good examples: iOS & Android .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM