Reuse already existing instance of print manager
This commit is contained in:
parent
62ae354984
commit
c75bd32982
@ -143,7 +143,6 @@ public class Printer extends CordovaPlugin {
|
|||||||
cordova.getThreadPool().execute(new Runnable() {
|
cordova.getThreadPool().execute(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
PrintManager pm = new PrintManager(cordova.getActivity());
|
|
||||||
List<PrintServiceInfo> services = pm.getEnabledPrintServices();
|
List<PrintServiceInfo> services = pm.getEnabledPrintServices();
|
||||||
Boolean available = services.size() > 0;
|
Boolean available = services.size() > 0;
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ package de.appplant.cordova.plugin.printer.ext;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.print.PrintJob;
|
import android.print.PrintJob;
|
||||||
import android.print.PrintJobId;
|
import android.print.PrintJobId;
|
||||||
import android.print.PrinterInfo;
|
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.lang.reflect.InvocationHandler;
|
import java.lang.reflect.InvocationHandler;
|
||||||
|
@ -47,8 +47,10 @@ public abstract class Meta {
|
|||||||
try {
|
try {
|
||||||
return cls.getDeclaredMethod(name, params);
|
return cls.getDeclaredMethod(name, params);
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
return null;
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user