EMDKManager.getEMDKManager return NULL

// Expert user has replied.
J Jean-Yves BLANCHETTE 3 years 7 months ago
83 1 0

Hello,I am developing an application to programmatically modify a DataWedge profile. But, I can not instantiate my profile manager it is still "null"Here is my code:
 
Thank You for helping
 
Jean-Yves Blanchette
 
//********************************************************
1 - Call
//********************************************************
public void jDWMod()
{
Intent myIntent = new Intent(getApplicationContext(), clDWMod_TEST.class);
myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
getContexteApplication().startActivity(myIntent);
}
 
//********************************************************
2 - Class
//********************************************************
public static class clDWMod_TEST extends Activity implements EMDKListener {
private EMDKManager emdkManager = null;
private ProfileManager profileManager = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EMDKResults results = EMDKManager.getEMDKManager(getApplicationContext(), this);
}
 
@Override
public void onClosed() {}
 
@Override
public void onOpened(EMDKManager emdkManager) {
DWMod(emdkManager);
}
 
void DWMod(EMDKManager emdkManager)  {
String profileName = "AI_2";
String inputFile;
String ligne;
StringBuffer stbuf = new StringBuffer();
 
this.emdkManager = emdkManager;
 
//********************************************************
// Problem
//********************************************************
 
               AlertDialog AlertDialog0= new AlertDialog.Builder(clDWMod_TEST.this).create();
               AlertDialog0.setTitle("EMDKManager");
               AlertDialog0.setMessage(emdkManager.toString()); // Return com.symbol.emdk.EMDKManager@xxxxxxxx
               AlertDialog0.show();
 
     profileManager = (ProfileManager) this.emdkManager.getInstance(EMDKManager.FEATURE_TYPE.PROFILE);
 
               if (profileManager != null) {
                    AlertDialog alertDialog1 = new AlertDialog.Builder(clDWMod_TEST.this).create();
                    alertDialog1.setTitle("getInstance");
                    alertDialog1.setMessage(profileManager.toString());
                    alertDialog1.show();
               }
               else {
                    AlertDialog alertDialog1 = new AlertDialog.Builder(clDWMod_TEST.this).create();
                    alertDialog1.setTitle("getInstance");
                    alertDialog1.setMessage("NULL"); // Always Return null
                    alertDialog1.show();
               }
 
//********************************************************
// Problem
//********************************************************
}
}

Please Register or Login to post a reply

1 Replies

P Peter Arcuri

Hi Jean-Yves,

Controlling DataWedge through profile manager within EMDK for Android, is exemplified in a tutorial located here. Datawedge is typically used for scanner unaware application that are at play, essentially canned apps where code is unavailable or unwilling to mod code. However, for whatever reason DW can also be called through APIs and profile manager feature of EMDK, as your post is referring to.

In most cases, app development using EMDK for Android can simple just use the BacodeManager to control the scanner and therefore remove the need for using and managing DataWedge profiles. There is also an advanced tutorial on using Barcode API here.

CONTACT
Can’t find what you’re looking for?