Overview

While you can configure your application to enable or disable certain functionality we provide, you can also extend the functionality of your mobile application with plugins you’ve already created.

To add a plugin for any device, you must build your application on Mac.

We currently support plugins built in Flutter.


Using Flutter

You can add a plugin using Flutter for Android or iOS:


Prerequisites


For Android

  1. Create a Flutter module on your development Mac machine:
Create Flutter Module
1
2
cd some/path/
flutter create --template module <module_name>
  1. Add your Dart code to the lib/ directory, which exists within the Flutter directory you just created.

  2. In <module_name>/, create an Android Archive (AAR) for your Flutter module:

Create an Android Archive
1
2
cd <module_name>
flutter build aar
  1. In your MXmobile project directory, open client/default/config/configuration.yaml and enable your Flutter plugin by setting has_flutter_plugin: true.

  2. Configure your project to direct where your plugin should launch from.

  3. Open <your_mobile_application>/proj.android/app/build.gradle and add the following to the bottom of the file:

Add to Gradle File
1
2
3
4
5
6
7
8
9
String storageUrl = System.env.FLUTTER_STORAGE_BASE_URL ?: "https://storage.googleapis.com"
    repositories {
        maven {
            url '<path_to_flutter_module>/build/host/outputs/repo'
        }
        maven {
            url "$storageUrl/download.flutter.io"
        }
    }
  1. In that file, replace <path_to_flutter_module> with your Flutter module location.

  2. Open your project in Android Studio and build.


For iOS

  1. Create a Flutter module on your development Mac machine:
Create Flutter Module
1
2
cd some/path/
flutter create --template module <module_name>
  1. Add your Dart code to the lib/ directory, which exists within the Flutter directory you just created.

  2. In your MXmobile project directory, open client/default/config/configuration.yaml and enable your Flutter plugin by setting has_flutter_plugin: true.

  3. Configure your project to direct where your plugin should launch from.

  4. Create a Podfile at the following location in your MXmobile project directory:

Create a Podfile
1
2
cd ./institutions/<institution_name>/proj.apple
vi Podfile
  1. Add the following content to that Podfile:
Add to Podfile
1
2
3
4
5
6
7
8
9
10
11
platform :ios, '11.0'
flutter_application_path = '<path_to_flutter_module>'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')

target 'Helios iOS' do
install_all_flutter_pods(flutter_application_path)
end

post_install do |installer|
flutter_post_install(installer) if defined?(flutter_post_install)
end
  1. In that Podfile, replace <path_to_flutter_module> with your Flutter module location.

  2. In the same directory as your Podfile, install pods:

Install Pods
1
pod install
  1. Depending on if you’re in debug or release mode, append the following:
  • If in debug mode, append the content of Pods-Helios iOS.debug.xcconfig to ios/generated-ios-debug.xcconfig:
Debug: Append Pods-Helios Content
1
cat Pods/Target\ Support\ Files/Pods-Helios\ iOS/Pods-Helios\ iOS.debug.xcconfig >> ios/generated-ios-debug.xcconfig
  • If in release mode, append the content of Pods-Helios iOS.release.xcconfig to ios/generated-ios-release.xcconfig:
Release: Append Pods-Helios Content
1
cat Pods/Target\ Support\ Files/Pods-Helios\ iOS/Pods-Helios\ iOS.release.xcconfig >> ios/generated-ios-release.xcconfig
  1. Open <app_name>.xcworkspace in Xcode and build.