Skip to content

Commit 8eb1113

Browse files
authored
Merge pull request #1 from ltrudu/master
Added functionalities and logs
2 parents cb15ab4 + dab4fd9 commit 8eb1113

File tree

2 files changed

+39
-4
lines changed

2 files changed

+39
-4
lines changed

CriticalPermissionsHelper/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ android {
1313
defaultConfig {
1414
minSdkVersion 30
1515
targetSdkVersion 32
16-
versionCode 2
17-
versionName "0.2"
16+
versionCode 3
17+
versionName "0.3"
1818

1919
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
2020

@@ -38,5 +38,5 @@ dependencies {
3838
testImplementation 'junit:junit:4.13'
3939
androidTestImplementation 'com.android.support.test:runner:1.0.2'
4040
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
41-
compileOnly 'com.symbol:emdk:+'
41+
compileOnly 'com.symbol:emdk:9.1.1'
4242
}

CriticalPermissionsHelper/src/main/java/com/zebra/criticalpermissionshelper/ProfileManagerCommand.java

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,18 @@ protected class ErrorHolder
6767
public void onStatus(EMDKManager.StatusData statusData, EMDKBase emdkBase) {
6868
if(statusData.getResult() == EMDKResults.STATUS_CODE.SUCCESS)
6969
{
70-
onProfileManagerInitialized((ProfileManager)emdkBase);
70+
ProfileManager profileManager = (ProfileManager)emdkBase;
71+
if(profileManager != null)
72+
onProfileManagerInitialized(profileManager);
73+
else
74+
{
75+
logMessage("Casting error when retrieving ProfileManager.", EMessageType.ERROR);
76+
profileManager = (ProfileManager) mEMDKManager.getInstance(EMDKManager.FEATURE_TYPE.PROFILE);
77+
if(profileManager != null) {
78+
logMessage("Profile manager retrieved synchronously with success", EMessageType.VERBOSE);
79+
onProfileManagerInitialized(profileManager);
80+
}
81+
}
7182
}
7283
else
7384
{
@@ -267,6 +278,30 @@ private void processMXContent()
267278
String[] params = new String[1];
268279
params[0] = msProfileData;
269280

281+
if(mProfileManager == null)
282+
{
283+
logMessage("ProcessMXContent : Error : ProfileManager == null", EMessageType.ERROR);
284+
if(mEMDKManager != null) {
285+
logMessage("ProcessMXContent : Trying to retrieve profileManager synchronously", EMessageType.ERROR);
286+
ProfileManager profileManager = (ProfileManager) mEMDKManager.getInstance(EMDKManager.FEATURE_TYPE.PROFILE);
287+
if (profileManager != null) {
288+
logMessage("ProcessMXContent, ProfileManager retrieved syncrhonously.",EMessageType.VERBOSE);
289+
mProfileManager = profileManager;
290+
}
291+
else
292+
{
293+
logMessage("ProcessMXContent : Error : Could not retrieve ProfileManager syncrhonously.",EMessageType.VERBOSE);
294+
onProfileExecutedError("ProcessMXContent : Error : Could not retrieve ProfileManager syncrhonously.");
295+
return;
296+
}
297+
}
298+
else {
299+
logMessage("ProcessMXContent : Error : mEMDKManager == null", EMessageType.ERROR);
300+
onProfileExecutedError("ProcessMXContent : Error : mEMDKManager == null");
301+
return;
302+
}
303+
}
304+
270305
EMDKResults results = mProfileManager.processProfile(msProfileName, ProfileManager.PROFILE_FLAG.SET, params);
271306

272307
//Check the return status of processProfile

0 commit comments

Comments
 (0)