Home > Software design >  Access Intune configuration settings in a React Native application?
Access Intune configuration settings in a React Native application?

Time:02-14

My company is doing Mobile Device Management with Microsoft Intune. We've successfully deployed an internal iOS app (using the Apple Developer Enterprise Program).

With Intunes' configuration settings we're trying to make each user's individual email available to the mobile app. https://docs.microsoft.com/en-us/mem/intune/apps/app-configuration-policies-use-ios

How do you normally access these types of settings in an app? I found this library but I'd need to eject from Expo which is not ideal for me: https://github.com/robinpowered/react-native-mdm

CodePudding user response:

As the MDM has native dependencies, You'll not be able to make it with Expo. Expo projects are written only in JavaScript and don't support packages that contain Objective-C or Java (Native code/dependencies).

Expo provides an advanced SDK called ExpoKit for when you absolutely need to use custom native code. However, there are some cases where developers need native capabilities outside of what Expo offers directly. The most common situation is when a project requires a specific Native Module (like MDM) that is not supported by React Native Core or the Expo SDK. You'll have to detach the Expo project to create Xcode and Android Studio projects that contain ExpoKit. This step will generate android and ios project directories. Then you would add custom Objective-C or Java the same way as with any other Xcode or Android Studio project.

The Expo docs warn about some of the downsides of writing custom native code and discourage most of our developers from taking this route, as Expo's motive, almost everything you need to do is better accomplished in a cross-platform way with JS. Writing in JS enables you to best take advantage of code aster deployment and benefit from ongoing updates and support from Expo. You should only do this if you have a particular demand from native code which Expo won’t do a good job supporting, such as (for example) specialized CPU-intensive video processing that must happen locally on the device, Custom native libraries.

Here are only two options to support the MDM, either eject the project or create react-native-cli project and migrate your project into newly created one.

CodePudding user response:

You can add expo support into react-native-mdm by fork react-native-mdm and use Config Plugins

here is the PR for adding expo support into the native package https://github.com/Shobbak/react-native-compressor/pull/62

After adding support you just have to do

Managed Expo

yarn install react-native-mdm from your fork

Add the react-native-mdm plugin to your Expo config (app.json, app.config.json or app.config.js):

{
  "name": "my app",
  "plugins": ["react-native-mdm"]
}

Finally, compile the mods:

expo prebuild

To apply the changes, build a new binary with EAS:

eas build
  • Related