IDTech Android SDK Guide  1.00.077
API reference for UniPay 1.5
Allocate/initialize UniPay 1.5 objects:

Initialize IDT_Device object by passing context and OnReceiverListener delegate. Load the XML file for more device compatibility

// declaring the instance of the UniPayReader;
private IDT_UniPayI_V myUniPayReader = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if(myUniPayReader!=null){
myUniPayReader.unregisterListen();
myUniPayReader.release();
myUniPayReader = null;
}
myUniPayReader = new IDT_UniPayI_V(this,getActivity());
myUniPayReader.registerListen();
loadXMLfile()
}
private String getXMLFileFromRaw(String fileName ,int res){
//the target filename in the application path
String fileNameWithPath = null;
fileNameWithPath = fileName;
String newFilename = fileName;
try {
InputStream in = getResources().openRawResource(res);
int length = in.available();
byte [] buffer = new byte[length];
in.read(buffer);
in.close();
deleteFile(fileNameWithPath);
FileOutputStream fout = openFileOutput(fileNameWithPath, MODE_PRIVATE);
fout.write(buffer);
fout.close();
// to refer to the application path
File fileDir = this.getFilesDir();
fileNameWithPath = fileDir.getParent() + java.io.File.separator + fileDir.getName();
fileNameWithPath += java.io.File.separator+newFilename;
} catch(Exception e){
e.printStackTrace();
fileNameWithPath = null;
}
return fileNameWithPath;
}
private String getConfigurationFileFromRaw( ){
return getXMLFileFromRaw("idt_unimagcfg_default.xml",R.raw.idt_unimagcfg_default);
}
private boolean isFileExist(String path) {
if(path==null)
return false;
File file = new File(path);
if (!file.exists()) {
return false ;
}
return true;
}
private void loadXMLfile(){
//load the XML configuratin file
String fileNameWithPath = getConfigurationFileFromRaw();
if(!isFileExist(fileNameWithPath)) {
fileNameWithPath = null;
}
// Network operation is prohibited in the UI Thread if target API is 11 or above.
// If target API is 11 or above, please use AsyncTask to avoid errors.
myUniPayReader.config_setXMLFileNameWithPath(fileNameWithPath);
Log.d("Demo Info >>>>>","loadingConfigurationXMLFile begin.");
myUniPayReader.config_loadingConfigurationXMLFile(true);
}