Dear ,
I have the following MainActivity class and the app crashes as soon as i call the initializescanner method.All i wanted to do is start the scanner as soon as the app starts.
public class MainActivity implements EMDKListener {
private BarcodeManager barcodeManager = null; private Scanner scanner = null;
private EMDKManager emdkManager = null;
@Overrideprotected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
EMDKResults results = EMDKManager.getEMDKManager(getApplicationContext(), this); if (results.statusCode != EMDKResults.STATUS_CODE.SUCCESS) {
//Failed to request the EMDKManager }
}
@Override public void onOpened(EMDKManager emdkManager) {
this.emdkManager = emdkManager; try {
// Call this method to enable Scanner and its listeners initializeScanner(); } catch (ScannerException e) {
e.printStackTrace(); }
//The EMDK Manager is ready and now you can call other EMDK APIs. }
private void initializeScanner() throws ScannerException {
if (scanner == null) {
barcodeManager = (BarcodeManager) this.emdkManager // the app crashes here .getInstance(EMDKManager.FEATURE_TYPE.BARCODE);
scanner = barcodeManager.getDevice(BarcodeManager.DeviceIdentifier.DEFAULT); scanner.triggerType = Scanner.TriggerType.HARD; scanner.enable(); scanner.read(); }
}
@Override public void onClosed() {
/* EMDKManager is closed abruptly. Call EmdkManager.release() to free the resources used by the current EMDK instance. */ if (emdkManager != null) {
emdkManager.release(); emdkManager = null; }
}
@Override public void onDestroy(){
super.onDestroy(); if (emdkManager != null) {
emdkManager.release(); emdkManager = null; }
}
}
Error
4 Replies
Thanks so much for the continuous support one last think i am not able to find any links for downloading EMDK 6.0 download and after that what will be the steps to run Device Runtime Deployment as the link in zebra docs on Configure Device for Android was not clear. this is the link i refered
http://techdocs.zebra.com/emdk-for-android/6-0/guide/setupDevice/
Could it be the problem of not configuring the Device Runtime Deployment.I am using a TC70 device with Android 5.0 version how to configure the runtime deployment for this.
Hi, what device are you running on? And do you see this same behaviour with the barcode sample? Barcode APIs - Zebra Technologies Techdocs http://techdocs.zebra.com/emdk-for-xamarin/3-0/samples/barcode/
Hi Darryn,
Thanks for the quick response.Yes i tried those barcode sample api.And then i moved on to create new project to use the same code that is used in sample barcode api.
The device which i run is TC70 device.