0

I have integrated Blackberry Dynamics in my React Native App using the Blackberry-Dynamics-React-Native-SDK.

React Native Version - 0.63.4, BB Dynamics SDK version - 8.1

After passing through the authentication screens provided by BlackBerry Dynamics, I need the email address through which I logged in to BB Dynamics.

Is there any method to get the logged in user's email address?

---------------------------------

Tried the approach suggested by @JeffinWithYa in his answer below

Created a native module as shown below -

package com.myApp;

import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import java.util.Map;
import com.good.gd.GDAndroid;

public class BBAppConfig extends ReactContextBaseJavaModule {
   BBAppConfig(ReactApplicationContext context) {
       super(context);
   }

   @Override
    public String getName() {
        return "BBAppConfig";
    }

    @ReactMethod
    public Map<String, Object> getBBAppConfig() {
        Map<String, Object> appconfig = GDAndroid.getInstance().getApplicationConfig();
        return appconfig;
    }
}

And calling it in my code as -

const { BBAppConfig } = NativeModules;

console.log('bb module-----', BBAppConfig);

let appConfig = await BBAppConfig.getBBAppConfig();

console.log('---------bb app config----------', appConfig);

I am getting the native module, but the method returns undefined

Is there anything that I'm missing? Also I'm running my app in Simulation mode right now, could that be the issue?

1 Answers1

1

There is currently no API in the React-Native Dynamics library to get the authorized user's email address.

You could accomplish this via a bridging module to the native library. For Android, you get it from the GDAppConfigKeyUserId parameter in the getApplicationConfig call.

https://developer.blackberry.com/devzone/files/blackberry-dynamics/android/classcom_1_1good_1_1gd_1_1_g_d_android.html#aedeeab3604d3316fee1fda12cda56b8f

  • Hi Jeffin, thanks for your response. I tried doing the same by creating a native module in react native but the method returns undefined. I am attaching my code in the question above for your reference. Please let me know if I am missing something. – Tanuj Chawla Jun 03 '21 at 08:39
  • Also, I'm running my app in BB Dynamics Enterprise Simulation mode right now. Could that be the issue? – Tanuj Chawla Jun 03 '21 at 08:51