Bluetooth BLE ScanCallback stopped workingStop EditText from gaining focus at Activity startupHow to set view or Activity for dealing with previous listactivity? for example “see full detail page”Can someone show me a simple working implementation of PagerSlidingTabStrip?setText on button from another activity androidAdding Social Media Share Logic From Firebase in Androidjava.lang.NullPointerException when invoking onLoadFinished()Android TV - Bluetooth Low Energy SupportThis use Navigation Drawer, and use Tab, and use Fragment. how communication between FragmentActivity and Fragment?Manufacturer Specific Data on BLEGoogle Play License Verification Library with flutter
Creating patterns
Did Stalin kill all Soviet officers involved in the Winter War?
How should I present a resort brochure in my general fiction?
Why create or use Section 31 to carry out Article 14, Section 31 of the Starfleet charter when Starfleet intelligence can do it themselves?
Did Snape really give Umbridge a fake Veritaserum potion that Harry later pretended to drink?
Boss has banned cycling to work because he thinks it's unsafe
How to add an aggregate result from a SOQL query inside a map? Shows error- Unexpected token '['
Interview Question - Card betting
What's the big deal about the Nazgûl losing their horses?
Do the 26 richest billionaires own as much wealth as the poorest 3.8 billion people?
Sleepy tired vs physically tired
Speeding up thousands of string parses
Music Physics Question - Automatic Trumpet Embouchure Mouthpiece
Why did C++11 make std::string::data() add a null terminating character?
Term for a character that only exists to be talked to
Isn't "Dave's protocol" good if only the database, and not the code, is leaked?
How to supply water to a coastal desert town with no rain and no freshwater aquifers?
What is meaning of 4 letter abbreviations in Roman names like Titus Flavius T. f. T. n. Sabinus?
Is there a typical layout to blocking installed for backing in new construction framing?
Does Evolution Sage proliferate Blast Zone when played?
What is the name of the technique when an element is repeated at different scales?
Do I need to be legally qualified to install a Hive smart thermostat?
How to travel between two stationary worlds in the least amount of time? (time dilation)
Should I increase my 401(k) contributions, or increase my mortgage payments
Bluetooth BLE ScanCallback stopped working
Stop EditText from gaining focus at Activity startupHow to set view or Activity for dealing with previous listactivity? for example “see full detail page”Can someone show me a simple working implementation of PagerSlidingTabStrip?setText on button from another activity androidAdding Social Media Share Logic From Firebase in Androidjava.lang.NullPointerException when invoking onLoadFinished()Android TV - Bluetooth Low Energy SupportThis use Navigation Drawer, and use Tab, and use Fragment. how communication between FragmentActivity and Fragment?Manufacturer Specific Data on BLEGoogle Play License Verification Library with flutter
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am working on BLE devices android application. i am trying to get available bluetooth devices using scanCallBack. It was working fine some days ago but suddenly it stopped. onScanResults or onScanFailed nothing are NOT executing. I have given the ACCESS_COARSE_LOCATION, BLUETOOTH_ADMIN, BLUETOOTH and ACCESS_FINE_LOCATION in manifest and request permissions at run time also.Bluetooth is on and location is also on. Please help.
Measurement.java
public class MeasurementScreen extends AppCompatActivity
private BluetoothAdapter bluetoothAdapter;
static int REQUEST_ENABLE_BT = 1001;
private Boolean spinnerStatus= false;
private Handler handler = new Handler(Looper.getMainLooper());
final BluetoothAdapter mBluetoothAdapter =
BluetoothAdapter.getDefaultAdapter();
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.device_reading_screen);
Objects.requireNonNull(getSupportActionBar()).hide();
if (Build.VERSION.SDK_INT >= 23)
int permissionCheck = ContextCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_COARSE_LOCATION);
if (permissionCheck == -1 )
ActivityCompat.requestPermissions(this,
new String[]
Manifest.permission.ACCESS_COARSE_LOCATION
, 0);
final Button tryAgain = findViewById(R.id.tryagain);
next = findViewById(R.id.next);
back = findViewById(R.id.back);
progressDialog = new ProgressDialog(this);
bluetoothscan();
void bluetoothscan()
spinner();
scanBLEDevices(true);
private void scanBLEDevices(final boolean enable)
final BluetoothLeScanner bluetoothLeScanner = mBluetoothAdapter.getBluetoothLeScanner();
final BLEScanCallback scanCallback = new BLEScanCallback();
if (enable)
// Stops scanning after a pre-defined scan period.
handler.postDelayed(new Runnable()
@Override
public void run()
mScanning = false;
bluetoothLeScanner.stopScan(scanCallback);
, 10000);
mScanning = true;
bluetoothLeScanner.startScan(scanCallback);
else
mScanning = false;
bluetoothLeScanner.stopScan(scanCallback);
public class BLEScanCallback extends ScanCallback
@Override
public void onScanResult(int callbackType, ScanResult result)
super.onScanResult(callbackType, result);
Log.e("Scan Success", "Scan Success");
@Override
public void onBatchScanResults(List<ScanResult> results)
super.onBatchScanResults(results);
Log.e("Scan Success", "Scan Success Batch");
@Override
public void onScanFailed(int errorCode)
super.onScanFailed(errorCode);
Log.e("Scan Failed", "Error Code: " + errorCode);
This is the log output:-
D/BluetoothAdapter: STATE_ON
D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=6
mClientIf=0
android bluetooth-lowenergy android-bluetooth
add a comment |
I am working on BLE devices android application. i am trying to get available bluetooth devices using scanCallBack. It was working fine some days ago but suddenly it stopped. onScanResults or onScanFailed nothing are NOT executing. I have given the ACCESS_COARSE_LOCATION, BLUETOOTH_ADMIN, BLUETOOTH and ACCESS_FINE_LOCATION in manifest and request permissions at run time also.Bluetooth is on and location is also on. Please help.
Measurement.java
public class MeasurementScreen extends AppCompatActivity
private BluetoothAdapter bluetoothAdapter;
static int REQUEST_ENABLE_BT = 1001;
private Boolean spinnerStatus= false;
private Handler handler = new Handler(Looper.getMainLooper());
final BluetoothAdapter mBluetoothAdapter =
BluetoothAdapter.getDefaultAdapter();
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.device_reading_screen);
Objects.requireNonNull(getSupportActionBar()).hide();
if (Build.VERSION.SDK_INT >= 23)
int permissionCheck = ContextCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_COARSE_LOCATION);
if (permissionCheck == -1 )
ActivityCompat.requestPermissions(this,
new String[]
Manifest.permission.ACCESS_COARSE_LOCATION
, 0);
final Button tryAgain = findViewById(R.id.tryagain);
next = findViewById(R.id.next);
back = findViewById(R.id.back);
progressDialog = new ProgressDialog(this);
bluetoothscan();
void bluetoothscan()
spinner();
scanBLEDevices(true);
private void scanBLEDevices(final boolean enable)
final BluetoothLeScanner bluetoothLeScanner = mBluetoothAdapter.getBluetoothLeScanner();
final BLEScanCallback scanCallback = new BLEScanCallback();
if (enable)
// Stops scanning after a pre-defined scan period.
handler.postDelayed(new Runnable()
@Override
public void run()
mScanning = false;
bluetoothLeScanner.stopScan(scanCallback);
, 10000);
mScanning = true;
bluetoothLeScanner.startScan(scanCallback);
else
mScanning = false;
bluetoothLeScanner.stopScan(scanCallback);
public class BLEScanCallback extends ScanCallback
@Override
public void onScanResult(int callbackType, ScanResult result)
super.onScanResult(callbackType, result);
Log.e("Scan Success", "Scan Success");
@Override
public void onBatchScanResults(List<ScanResult> results)
super.onBatchScanResults(results);
Log.e("Scan Success", "Scan Success Batch");
@Override
public void onScanFailed(int errorCode)
super.onScanFailed(errorCode);
Log.e("Scan Failed", "Error Code: " + errorCode);
This is the log output:-
D/BluetoothAdapter: STATE_ON
D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=6
mClientIf=0
android bluetooth-lowenergy android-bluetooth
Please help @CommonsWare
– Chaitanya Parashar
Mar 26 at 2:52
Please help me with this @Blundell
– Chaitanya Parashar
Mar 26 at 3:17
Where is the '''handler''' initiated?
– iroiroys
Mar 26 at 6:21
added handler initialization @iroiroys
– Chaitanya Parashar
Mar 26 at 7:37
add a comment |
I am working on BLE devices android application. i am trying to get available bluetooth devices using scanCallBack. It was working fine some days ago but suddenly it stopped. onScanResults or onScanFailed nothing are NOT executing. I have given the ACCESS_COARSE_LOCATION, BLUETOOTH_ADMIN, BLUETOOTH and ACCESS_FINE_LOCATION in manifest and request permissions at run time also.Bluetooth is on and location is also on. Please help.
Measurement.java
public class MeasurementScreen extends AppCompatActivity
private BluetoothAdapter bluetoothAdapter;
static int REQUEST_ENABLE_BT = 1001;
private Boolean spinnerStatus= false;
private Handler handler = new Handler(Looper.getMainLooper());
final BluetoothAdapter mBluetoothAdapter =
BluetoothAdapter.getDefaultAdapter();
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.device_reading_screen);
Objects.requireNonNull(getSupportActionBar()).hide();
if (Build.VERSION.SDK_INT >= 23)
int permissionCheck = ContextCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_COARSE_LOCATION);
if (permissionCheck == -1 )
ActivityCompat.requestPermissions(this,
new String[]
Manifest.permission.ACCESS_COARSE_LOCATION
, 0);
final Button tryAgain = findViewById(R.id.tryagain);
next = findViewById(R.id.next);
back = findViewById(R.id.back);
progressDialog = new ProgressDialog(this);
bluetoothscan();
void bluetoothscan()
spinner();
scanBLEDevices(true);
private void scanBLEDevices(final boolean enable)
final BluetoothLeScanner bluetoothLeScanner = mBluetoothAdapter.getBluetoothLeScanner();
final BLEScanCallback scanCallback = new BLEScanCallback();
if (enable)
// Stops scanning after a pre-defined scan period.
handler.postDelayed(new Runnable()
@Override
public void run()
mScanning = false;
bluetoothLeScanner.stopScan(scanCallback);
, 10000);
mScanning = true;
bluetoothLeScanner.startScan(scanCallback);
else
mScanning = false;
bluetoothLeScanner.stopScan(scanCallback);
public class BLEScanCallback extends ScanCallback
@Override
public void onScanResult(int callbackType, ScanResult result)
super.onScanResult(callbackType, result);
Log.e("Scan Success", "Scan Success");
@Override
public void onBatchScanResults(List<ScanResult> results)
super.onBatchScanResults(results);
Log.e("Scan Success", "Scan Success Batch");
@Override
public void onScanFailed(int errorCode)
super.onScanFailed(errorCode);
Log.e("Scan Failed", "Error Code: " + errorCode);
This is the log output:-
D/BluetoothAdapter: STATE_ON
D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=6
mClientIf=0
android bluetooth-lowenergy android-bluetooth
I am working on BLE devices android application. i am trying to get available bluetooth devices using scanCallBack. It was working fine some days ago but suddenly it stopped. onScanResults or onScanFailed nothing are NOT executing. I have given the ACCESS_COARSE_LOCATION, BLUETOOTH_ADMIN, BLUETOOTH and ACCESS_FINE_LOCATION in manifest and request permissions at run time also.Bluetooth is on and location is also on. Please help.
Measurement.java
public class MeasurementScreen extends AppCompatActivity
private BluetoothAdapter bluetoothAdapter;
static int REQUEST_ENABLE_BT = 1001;
private Boolean spinnerStatus= false;
private Handler handler = new Handler(Looper.getMainLooper());
final BluetoothAdapter mBluetoothAdapter =
BluetoothAdapter.getDefaultAdapter();
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.device_reading_screen);
Objects.requireNonNull(getSupportActionBar()).hide();
if (Build.VERSION.SDK_INT >= 23)
int permissionCheck = ContextCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_COARSE_LOCATION);
if (permissionCheck == -1 )
ActivityCompat.requestPermissions(this,
new String[]
Manifest.permission.ACCESS_COARSE_LOCATION
, 0);
final Button tryAgain = findViewById(R.id.tryagain);
next = findViewById(R.id.next);
back = findViewById(R.id.back);
progressDialog = new ProgressDialog(this);
bluetoothscan();
void bluetoothscan()
spinner();
scanBLEDevices(true);
private void scanBLEDevices(final boolean enable)
final BluetoothLeScanner bluetoothLeScanner = mBluetoothAdapter.getBluetoothLeScanner();
final BLEScanCallback scanCallback = new BLEScanCallback();
if (enable)
// Stops scanning after a pre-defined scan period.
handler.postDelayed(new Runnable()
@Override
public void run()
mScanning = false;
bluetoothLeScanner.stopScan(scanCallback);
, 10000);
mScanning = true;
bluetoothLeScanner.startScan(scanCallback);
else
mScanning = false;
bluetoothLeScanner.stopScan(scanCallback);
public class BLEScanCallback extends ScanCallback
@Override
public void onScanResult(int callbackType, ScanResult result)
super.onScanResult(callbackType, result);
Log.e("Scan Success", "Scan Success");
@Override
public void onBatchScanResults(List<ScanResult> results)
super.onBatchScanResults(results);
Log.e("Scan Success", "Scan Success Batch");
@Override
public void onScanFailed(int errorCode)
super.onScanFailed(errorCode);
Log.e("Scan Failed", "Error Code: " + errorCode);
This is the log output:-
D/BluetoothAdapter: STATE_ON
D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=6
mClientIf=0
android bluetooth-lowenergy android-bluetooth
android bluetooth-lowenergy android-bluetooth
edited Mar 26 at 7:37
Chaitanya Parashar
asked Mar 25 at 19:04
Chaitanya ParasharChaitanya Parashar
1562 silver badges14 bronze badges
1562 silver badges14 bronze badges
Please help @CommonsWare
– Chaitanya Parashar
Mar 26 at 2:52
Please help me with this @Blundell
– Chaitanya Parashar
Mar 26 at 3:17
Where is the '''handler''' initiated?
– iroiroys
Mar 26 at 6:21
added handler initialization @iroiroys
– Chaitanya Parashar
Mar 26 at 7:37
add a comment |
Please help @CommonsWare
– Chaitanya Parashar
Mar 26 at 2:52
Please help me with this @Blundell
– Chaitanya Parashar
Mar 26 at 3:17
Where is the '''handler''' initiated?
– iroiroys
Mar 26 at 6:21
added handler initialization @iroiroys
– Chaitanya Parashar
Mar 26 at 7:37
Please help @CommonsWare
– Chaitanya Parashar
Mar 26 at 2:52
Please help @CommonsWare
– Chaitanya Parashar
Mar 26 at 2:52
Please help me with this @Blundell
– Chaitanya Parashar
Mar 26 at 3:17
Please help me with this @Blundell
– Chaitanya Parashar
Mar 26 at 3:17
Where is the '''handler''' initiated?
– iroiroys
Mar 26 at 6:21
Where is the '''handler''' initiated?
– iroiroys
Mar 26 at 6:21
added handler initialization @iroiroys
– Chaitanya Parashar
Mar 26 at 7:37
added handler initialization @iroiroys
– Chaitanya Parashar
Mar 26 at 7:37
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55344827%2fbluetooth-ble-scancallback-stopped-working%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55344827%2fbluetooth-ble-scancallback-stopped-working%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Please help @CommonsWare
– Chaitanya Parashar
Mar 26 at 2:52
Please help me with this @Blundell
– Chaitanya Parashar
Mar 26 at 3:17
Where is the '''handler''' initiated?
– iroiroys
Mar 26 at 6:21
added handler initialization @iroiroys
– Chaitanya Parashar
Mar 26 at 7:37