[Java for Android App Development] empax:
I am working on an Andriod project with Bluetooth LE. While BLE thread was scanning, this thread blocks other threads such as HTTP request and MediaPlayer . Http request is going to timeout or when i play music with meidplayer in app then app is freezing. I get this problem on thees android devices,Samsung Glaxy Tab SM-T700 and Samsung Galaxy TAB SM-T800. But i do not get this problem on Samsung Galaxy TAB SM-T520 device and any android phones.

BLE Scan Algorithm ` private BluetoothAdapter.LeScanCallback mLeScanCallback = new BluetoothAdapter.LeScanCallback() {

@Override
public void onLeScan(final BluetoothDevice device, final int rssi,
final byte[] scanRecord) {
ac.runOnUiThread(new Runnable() {
@Override
public void run() {

final BluetoothLeDevice deviceLe = new BluetoothLeDevice(
device, rssi, scanRecord, System
.currentTimeMillis());

// mDevices.add(deviceLe);
String rssiString = ac.getString(R.string.formatter_db,
String.valueOf(deviceLe.getRssi()));

if (tempDevice == null) {
tempDevice = deviceLe;

} else {
if (deviceLe.getRunningAverageRssi() > tempDevice
.getRunningAverageRssi()) {
IBeaconDevice newBeacon = new IBeaconDevice(
deviceLe);
IBeaconDevice bestDevice = new IBeaconDevice(
tempDevice);
if (newBeacon.getMajor() != bestDevice.getMajor()
|| newBeacon.getMinor() != bestDevice
.getMinor()) {

tempDevice = deviceLe;
}

}
}

}

// }
});

}
};` Music Play Algorithm . Mediaplayer is initialed before this code ` public void PlayPause() {

Log.e("Çalan", UrlSes);
if (mediaPlayer.isPlaying()) {
mediaPlayer.stop();
mediaPlayer.reset();
}
try {

mediaPlayer.setDataSource(UrlSes); // setup song from
// http://www.hrupin.com/wp-content/uploads/mp3/testsong_20_sec.mp3
// URL to mediaplayer data
// source
mediaPlayer.prepare(); // you must call this method after setup the
// datasource in setDataSource method. After
// calling prepare() the instance of
// MediaPlayer starts load data from URL to
// internal buffer.
} catch (Exception e) {
e.printStackTrace();
}

mediaFileLengthInMilliseconds = mediaPlayer.getDuration(); // gets the
// song
// length in
// milliseconds
// from URL

if (!mediaPlayer.isPlaying()) {
mediaPlayer.start();
imgPlay.setImageResource(R.drawable.footer_pause);
} else {
mediaPlayer.pause();
imgPlay.setImageResource(R.drawable.footer_play);
}

primarySeekBarProgressUpdater();
}` app freeze on mediplayer.prepare() I use mediplayer.prepareasync() but not plyaed . my web Request code `public JSONObject getJSONInfo(String functionName) {

HttpClient client = new DefaultHttpClient();
HttpConnectionParams.setConnectionTimeout(client.getParams(), 10000);

HttpResponse response;
JSONObject json = null;
JSONObject send = new JSONObject();
try {
HttpPost post = new HttpPost(
""+url);
send.put("", variable1);

send.put("", variable1);
send.put("", variable2);

send.put("", variable1);

StringEntity se = new StringEntity(send.toString());
se.setContentType(new BasicHeader(HTTP.CONTENT_TYPE,
"application/json"));

Log.e("test", send.toString());
post.setEntity(se);
response = client.execute(post);

if (response.getStatusLine().getStatusCode() == 200) {

json = new JSONObject(
EntityUtils.toString(response.getEntity()));
}
} catch (Exception e) {
e.printStackTrace();

}
return json;

}

I'think This problem not about code or algorithm. Maybe about setting in device. Please help.