Skip to content

Understanding your project / AirWatch MDM integration #17

@DaKaZ

Description

@DaKaZ

Hello,

I recently was pointed to your project and I am just wanting to learn a little more. Unfortunately your readme file just doesn't have the details I am looking for.

I am currently implementing an integration with the AirWatch SDK to provide MDM(ish) functions for our native app. Is react-native-mdm meant to be a generic interface for any MDM library? I am thinking it might be based on the code I just looked at.

For example, in my current implementation I have two main areas of development. First, I have a new react-native native-module named AirWatchReactNative. This module basically provides a dispatchEvent function that is used to notify the app when something happens as well as the list of supported events. Its implementation looks like this:

#import "AirWatchReactNative.h"
#if __has_include(<React/RCTEventDispatcher.h>)
#import <React/RCTEventDispatcher.h>
#else
#import "RCTEventDispatcher.h"
#endif

@implementation AirWatchReactNative
@synthesize sharedInstance;

+ (BOOL)requiresMainQueueSetup
{
  return NO;
}

- (instancetype)init
{
  self = [super init];
  self.sharedInstance = self;
  return self;
}

- (dispatch_queue_t)methodQueue
{
  return dispatch_get_main_queue();
}

- (void)dispatchEvent:(NSString *)name withBody: (NSDictionary *)body {
  NSLog(@"Calling dispatch: %@", name);
  [self sendEventWithName:name body:body];
}

- (NSArray<NSString *> *)supportedEvents
{
  return @[
           @"AWreceivedProfiles",
           @"AWenrollmentStatus",
           @"AWinitialCheck",
           @"AWwipe",
           @"AWlock",
           @"AWunlock",
           @"AWstopNetwork",
           @"AWresumeNetwork"
           ];
}

RCT_EXPORT_MODULE();

@end

I think call these methods when the AirWatch SDK functions are called. In my AppDelegate.swift file (yes, we had to use swift because AirWatch SDK is only available in swift now) we do this (just one example):

  func controllerDidReceive(profiles: [Profile]) {
    AWLogVerbose("SDK recieved \(profiles.count) profiles.")
    
    guard profiles.count > 0 else {
      AWLogError("No profile received")
      AirWatchReactNative().sharedInstance.dispatchEvent("AWreceivedProfiles", withBody: [
        "count": profiles.count,
        "profiles": []
        ]
      )
      return
    }
    AWLogInfo("Now printing profiles received: \n")
    profiles.forEach { AWLogInfo("\(String(describing: $0))") }
    AirWatchReactNative().sharedInstance.dispatchEvent("AWreceivedProfiles", withBody: [
      "count": profiles.count,
      "profiles": profiles
      ]
    )
  }

What I am wondering is if react-native-mdm is meant to replace my AirWatchReactNative module and if so, what your roadmap for features looks like as there are numerous events beyond app_config that need to be supported. If this is your intended purpose, I'd gladly lend effort to extend react-native-mdm to support our needs, but if it is not, I just need to know so that I don't waste the effort.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions