Android Bluetooth connectiong using createInsecureRfcommSocketToServiceRecord or createRfcommSocketToServiceRecord On a Samsung Device Android 7 -
i have problems connecting bluetooth device samsung galaxy devices android 6 or 7. same code working on other devices android 7 , htc m9 example.
my code far:
try { adapter.canceldiscovery(); socket = device.createinsecurerfcommsockettoservicerecord(btuuid); socket.connect(); publishprogress(context.getstring(r.string.bt_con_established)); int r; byte[] s = new byte[256]; bufferedinputstream in = new bufferedinputstream(socket.getinputstream()); while(!iscancelled() && (r = in.read(s)) != -1) { publishprogress(new string(s, 0, r)); } } catch (ioexception e) { e.printstacktrace(); if(!iscancelled()) { return context.getstring(r.string.bt_con_error); } } { try { if(socket != null) { socket.close(); } } catch (ioexception e) { e.printstacktrace(); return context.getstring(r.string.bt_con_not_closed); } } i receive issocketallowedbysecuritypolicy.
someone have idea, why not working on samsung devices? there special security rules on samsung or knox devices?
i used uuid 0000110e-0000-1000-8000-00805f9b34fb same error.
many thanks
Comments
Post a Comment