2

I working in V7 POS Terminal(Printing Module) android Machine(V5.1.1). I Have configured the SDK (Jar file) in My application. Server Application is Installed the POS Machine. The Problem occurred during the print. Here I have included my steps. I am stuck in the Problem more than a Day. Help me fix it.

Service Started.

public void startService(){
    Intent intent = new Intent();
    intent.setAction("com.justtide.service.dev.AIDL_SERVICE");
    intent.setPackage("com.justtide.service.dev");
    bindService(intent, mConnection, Service.BIND_AUTO_CREATE);
}

Device Provider

private ServiceConnection mConnection = new ServiceConnection() {

    @Override
    public void onServiceDisconnected(ComponentName name) {
    }

    @Override
    public synchronized void onServiceConnected(ComponentName name, IBinder service) {
        // TODO Auto-generated method stub
        mDeviceProvider = DeviceProvider.Stub.asInterface(service);

    }
};

Printer Provider

printerProvider =mDeviceProvider.getPrinterProvider();

printerProvider.fillStringFormat("TEST",PRINTER_FONT_SIZE_SMALL,PRINTER_FONT_TYPE_BOLD,PRINTER_ALIGNMENT_CENTER);
printerProvider.fillString("001420183990573");
int ret=-1;
try{
     ret =  printerProvider.print(); //  The Problem is occurred here.
    } catch (RemoteException e) {
        e.printStackTrace();
    }

Here I have included my Error Logs in POS Machine.

Error Selected Application

com.example.justtidev7_demo I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@3e9ea6fc time:3027349
com.example.justtidev7_demo W/System.err: android.os.DeadObjectException
com.example.justtidev7_demo W/System.err:     at android.os.BinderProxy.transactNative(Native Method)
com.example.justtidev7_demo W/System.err:     at android.os.BinderProxy.transact(Binder.java:496)
com.example.justtidev7_demo W/System.err:     at com.justtide.service.dev.aidl.printer.PrinterProvider$Stub$Proxy.print(PrinterProvider.java:274)
com.example.justtidev7_demo W/System.err:     at 
com.justtide.dao.Printer.print(Printer.java:34)
com.example.justtidev7_demo W/System.err:     at 
com.justtide.activity.PrintActivity$3.run(PrintActivity.java:111)
com.example.justtidev7_demo W/System.err:     at java.lang.Thread.run(Thread.java:818)

Error No Filter

    JustD: jdc_connect ...
02-08 15:36:51.577 15261-15276/? E/JavaBinder: *** Uncaught remote 
exception!  (Exceptions are not yet supported across processes.)
java.lang.NoSuchMethodError: No virtual method printerOpen()I in class 
Lcom/just/api/PosDevice; or its super classes (declaration of 
'com.just.api.PosDevice' appears in 
/system/framework/framework.jar:classes2.dex) at 
com.justtide.justtide.aq.d(Unknown Source) at justtide.PrintPicture.startPrint(Unknown Source) at com.justtide.service.dev.i.print(Unknown Source) at com.justtide.service.dev.aidl.printer.PrinterProvider$Stub.onTransact(Unknown Source) at android.os.Binder.execTransact(Binder.java:446)
02-08 15:36:51.577 15261-15276/? E/AndroidRuntime: FATAL EXCEPTION: Binder_1
Process: com.justtide.service.dev, PID: 15261
                                               java.lang.NoSuchMethodError: No virtual method printerOpen()I in class Lcom/just/api/PosDevice; or its super classes (declaration of 'com.just.api.PosDevice' appears in /system/framework/framework.jar:classes2.dex)
                                                   at com.justtide.justtide.aq.d(Unknown Source)
                                                   at justtide.PrintPicture.startPrint(Unknown Source)
                                                   at com.justtide.service.dev.i.print(Unknown Source)
                                                   at com.justtide.service.dev.aidl.printer.PrinterProvider$Stub.onTransact(Unknown Source)
                                                   at android.os.Binder.execTransact(Binder.java:446)
sivaprakash
  • 528
  • 6
  • 15

1 Answers1

0

It's been over a year, but hey ... let me try to answer this for future readers

Well, for starters the exception DeadObjectException simply means that the object you are calling has died, because its hosting process no longer exists.

I can see that you did not unbind your connection and you are probably using a connection that is already dead, yet you are calling the print function on it. (You are leaking it, check your logs)

And I would recommend that you try catch all the statements from PrinterProvider and start a printer connection on your Application class file (i.e class App extends Application) expose that object and establish a static connection then use that in your activities, That way you can bind and unbind only once when needed or when exiting an activity.

public class App extends Application {
    protected App app;
    public static DeviceProvider deviceProvider;
    public static PrinterProvider printerProvider;
    public static UtilsProvider utils;

    private static ServiceConnection conn;

    @Override
    public void onCreate() {
        // TODO Auto-generated method stub
        super.onCreate();
        this.app = (App) getApplicationContext();
    }

    /* do your thing i.e connection, 
    * static methods for printing e.t.c expose them , 
    * use them in your activities
    */

}

Or if any of this does not make any sense , you can always ask for a well documented SDK from the manufacturer.

Hope this helps someone. Thanks

Fahad
  • 1,943
  • 22
  • 27