android - How to get OnServiceConnected to run? -
i've created serviceconnection object called connection.
however, onserviceconnected method never called.
any ideas on how work? thanks
heres code:
public static boolean print(string message){ if(printerinitialized != true){ log.e(tag,"unitialized printer. can't print"); return false; } intent sendintent = new intent(); sendintent.setaction(intent.action_send); sendintent.putextra("mac", printeruuid); sendintent.putextra("data", message); sendintent.setcomponent(new componentname("com.blueslib.android.app","com.blueslib.android.app.printservice")); context.getapplicationcontext().bindservice(sendintent,connection, context.bind_auto_create); return true; } public static serviceconnection connection = new serviceconnection() { @override public void onservicedisconnected(componentname name) { log.e("system.out", "service disconnected"); } @override public void onserviceconnected(componentname name, ibinder service) { log.e("system.out", "service connected"); } };
Comments
Post a Comment