m.borghesi Posted December 8, 2010 Share Posted December 8, 2010 (edited) Salut à tous, Voici mon problème : J'ai développé une application sur un téléphone (le HTC désire) et j'ai essayé de la passer sous une tablette (samsung galaxy tab). Chose importante à savoir : le téléphone est sous 2.1 et la tablette sous 2.2. Mon application utilise un périphérique bluetooth afin d'échanger des données avec l'application. J'obtiens des différences assez bizarre... Premièrement, sur la tablette je dois, à chaque nouvelle connexion, renseigner le code d'appairage du périphérique bluetooth (chose que je ne dois pas faire sur le téléphone...). Normal ? Deuxièmement, lorsque je quitte l'application depuis la tablette celle ci plante totalement... Alors que sur le téléphone il n'y a aucun probleme. J'ai repéré le problème cela viens de la socket bluetooth apparement, puisque quand je vire le code associé ça plante plus... (mais mon application devient du coup inutile^^). Je précise que je ferme proprement la socket après chaque utilisation... Voici comment j'utilise la socket pour la connexion : public BluetoothSocket connectTest(String adr) { BluetoothDevice hxm; Method m; try { hxm = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(adr); m = hxm.getClass().getMethod("createRfcommSocket", new Class[]{int.class}); socket = (BluetoothSocket)m.invoke(hxm, Integer.valueOf(1)); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NoSuchMethodException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); } return socket; } // connectTest J'ai essayé aussi avec une autre méthode (qui marche sur le téléphone mais qui plante la tablette) : public BluetoothSocket connectByAndroid(BluetoothDevice mmDevice) { BluetoothSocket mmSocket=null; UUID myUUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"); try { // MY_UUID is the app's UUID string, also used by the server code mmSocket = mmDevice.createRfcommSocketToServiceRecord(myUUID); //mmSocket. } catch (IOException e) { io.errorMessage("btcontroler creatRfcom l:154 :"+e.getMessage()); } return mmSocket; } // connectByAndroid Une idée du problème? Ce que je comprend absolument pas c'est que toutes ces méthodes marche mais lorsque je quitte le programme ça plante... Edited December 8, 2010 by m.borghesi Quote Link to comment Share on other sites More sharing options...
SlayTaniK Posted January 28, 2011 Share Posted January 28, 2011 bonjour :) il me semble que : HTC Bluetooth® 2.1 avec EDR A2DP pour casque et système audio sans fil FTP et OPP (Object Push) pour le transfert de fichiers Autres profils pris en charge: AVRCP, GAP, GOEP, HFP, HSP, PBAP, PSP, Service Discovery Application profil GALAXY TAB Connectivité Bluetooth 3.0 Bluetooth Profiles GAP, SSP, SDAP, HSP, HFP1.5, A2DP, AVRCP, SPP, DUN, FTP, SAP, BPP, OPP, PBAP d'apres les fiches techniques des construtcteurs... possible incompatibilité? Quote Link to comment Share on other sites More sharing options...
Chronogps Posted March 20, 2011 Share Posted March 20, 2011 D'après ce que j'ai lu ce serait une question d'implémentation du bluetooth par le constructeur : http://stackoverflow.com/questions/2207975/bluetooth-service-discovery-failed http://stackoverflow.com/questions/3397071/android-bluetooth-service-discovery-failed-exception Honestly, I do not. From what I've read it might have something to do with the Bluetooth support that HTC is lacking in their phones and by using the reflection its a work around. – TxAg Oct 25 '10 at 19:56 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.