Skip to content

Commit bcb9a68

Browse files
committed
added more log information
1 parent 37910f8 commit bcb9a68

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

.idea/.name

Lines changed: 0 additions & 1 deletion
This file was deleted.

.idea/gradle.xml

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

DeviceIdentifiersWrapper/src/main/java/com/zebra/deviceidentifierswrapper/DIHelper.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ public class DIHelper {
2727
protected static String sIMEI = null;
2828
protected static String sSerialNumber = null;
2929

30-
private static final long MIN_IN_MS = 1000 * 60;
30+
public static final long SEC_IN_MS = 1000;
31+
public static final long MIN_IN_MS = SEC_IN_MS * 60;
3132
public static long MAX_EMDK_TIMEOUT_IN_MS = 10 * MIN_IN_MS; // 10 minutes
33+
public static long WAIT_PERIOD_BEFORE_RETRY_EMDK_RETRIEVAL_IN_MS = 2 * SEC_IN_MS; // 2 seconds
3234

3335
public static void resetCachedValues()
3436
{

DeviceIdentifiersWrapper/src/main/java/com/zebra/deviceidentifierswrapper/DIProfileManagerCommand.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,20 +152,25 @@ private void initializeEMDK()
152152

153153
private void waitForEMDK()
154154
{
155+
logMessage("EMDKManager error, this could be a BOOT_COMPLETED issue.", EMessageType.DEBUG);
156+
logMessage("Starting watcher thread to wait for EMDK initialization.", EMessageType.DEBUG);
155157
Thread t = new Thread(new Runnable() {
156158
@Override
157159
public void run() {
158160
long startDate = new Date().getTime();
159161
long delta = 0;
160-
long maxWait = 1000 * 60 * 10; // We will try for 10 mns... before stopping
161162
while(mEMDKManager == null || delta < DIHelper.MAX_EMDK_TIMEOUT_IN_MS ) {
163+
// Try to initialize EMDK
164+
logMessage("Calling EMDK Initialization method", EMessageType.DEBUG);
162165
initializeEMDK();
163166
try {
164-
Thread.sleep(5000);
167+
logMessage("Waiting " + DIHelper.WAIT_PERIOD_BEFORE_RETRY_EMDK_RETRIEVAL_IN_MS + " milliseconds before retrying.", EMessageType.DEBUG);
168+
Thread.sleep(DIHelper.WAIT_PERIOD_BEFORE_RETRY_EMDK_RETRIEVAL_IN_MS);
165169
} catch (InterruptedException e) {
166170
e.printStackTrace();
167171
}
168172
delta = new Date().getTime() - startDate;
173+
logMessage("Delta in ms since first EMDK retrieval try: " + delta + "ms stops at " + DIHelper.MAX_EMDK_TIMEOUT_IN_MS + "ms", EMessageType.DEBUG);
169174
}
170175
}
171176
});

settings.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
include ':SampleApplication',':DeviceIdentifiersWrapper'
2-
rootProject.name = "EMDK-DeviceIdentifiers-Sample"
1+
include ':DeviceIdentifiersWrapper'
2+
rootProject.name = "DeviceIdentifiersWrapper"

0 commit comments

Comments
 (0)