Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit 38d01e5

Browse files
committed
2 parents 7452b4a + 60cb3ef commit 38d01e5

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
The BLE Peripheral Simulator is an Android app that allows developers to try
44
out new features of Web Bluetooth without the need for a BLE Peripheral Device.
55

6+
You can build it from source or install it from the [Google Play Store](https://play.google.com/store/apps/details?id=io.github.webbluetoothcg.bletestperipheral).
7+
68
A developer can use the app to simulate a BLE Peripheral with one of two services:
79

810
* Battery Service

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ android {
88
applicationId "io.github.webbluetoothcg.bletestperipheral"
99
minSdkVersion 21
1010
targetSdkVersion 22
11-
versionCode 2
12-
versionName "2.0"
11+
versionCode 3
12+
versionName "3.0"
1313
}
1414
buildTypes {
1515
release {

app/src/main/java/io/github/webbluetoothcg/bletestperipheral/Peripheral.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import android.content.Intent;
3434
import android.os.Bundle;
3535
import android.util.Log;
36+
import android.view.WindowManager;
3637
import android.widget.TextView;
3738
import android.widget.Toast;
3839

@@ -171,11 +172,12 @@ public void onCharacteristicWriteRequest(BluetoothDevice device, int requestId,
171172
protected void onCreate(Bundle savedInstanceState) {
172173
super.onCreate(savedInstanceState);
173174
setContentView(R.layout.activity_peripherals);
175+
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
174176
mAdvStatus = (TextView) findViewById(R.id.textView_advertisingStatus);
175177
mConnectionStatus = (TextView) findViewById(R.id.textView_connectionStatus);
176178
mBluetoothDevices = new HashSet<>();
177-
// TODO(g-ortuno): This can be moved to Peripherals.
178-
ensureBleFeaturesAvailable();
179+
mBluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
180+
mBluetoothAdapter = mBluetoothManager.getAdapter();
179181

180182
// If we are not being restored from a previous state then create and add the fragment.
181183
if (savedInstanceState == null) {
@@ -303,9 +305,6 @@ public void run() {
303305
////// Bluetooth //////
304306
///////////////////////
305307
private void ensureBleFeaturesAvailable() {
306-
mBluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
307-
mBluetoothAdapter = mBluetoothManager.getAdapter();
308-
309308
if (mBluetoothAdapter == null) {
310309
Toast.makeText(this, R.string.bluetoothNotSupported, Toast.LENGTH_LONG).show();
311310
Log.e(TAG, "Bluetooth not supported");

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
<!-- Adv -->
2929
<string name="label_advertisingStatus">Advertising Status</string>
30-
<string name="status_advertising">Advertising</string>
30+
<string name="status_advertising">Advertising (Keep Screen On)</string>
3131
<string name="status_notAdvertising">Not Advertising</string>
3232
<string name="status_advDataTooLarge">Not Advertising. Advertisement is larger than 31 bytes.</string>
3333
<string name="status_advFeatureUnsupported">Not Advertising. Advertising not supported.</string>

0 commit comments

Comments
 (0)