Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BeaconsApp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LSDS
Teaching
Master
IoT
BeaconsApp
Commits
1fa5455b
Commit
1fa5455b
authored
4 years ago
by
raoul.dupuis
Browse files
Options
Downloads
Patches
Plain Diff
add onResume and onPause BLE start/stop
parent
c9aa3ee5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/src/main/java/com/example/iot_hes/iotlab/MainActivity.java
+13
-9
13 additions, 9 deletions
...rc/main/java/com/example/iot_hes/iotlab/MainActivity.java
with
13 additions
and
9 deletions
app/src/main/java/com/example/iot_hes/iotlab/MainActivity.java
+
13
−
9
View file @
1fa5455b
...
@@ -127,15 +127,7 @@ public class MainActivity extends AppCompatActivity {
...
@@ -127,15 +127,7 @@ public class MainActivity extends AppCompatActivity {
beaconManager
.
setForegroundScanPeriod
(
2000
,
1000
);
beaconManager
.
setForegroundScanPeriod
(
2000
,
1000
);
beaconManager
.
connect
(
new
BeaconManager
.
ServiceReadyCallback
()
{
@Override
public
void
onServiceReady
()
{
String
msg
=
"Beacons: start scanning..."
;
PositionText
.
setText
(
msg
);
Log
.
d
(
TAG
,
msg
);
beaconManager
.
startRanging
(
region
);
}
});
// Only accept input values between 0 and 100
// Only accept input values between 0 and 100
...
@@ -204,12 +196,24 @@ public class MainActivity extends AppCompatActivity {
...
@@ -204,12 +196,24 @@ public class MainActivity extends AppCompatActivity {
@Override
@Override
protected
void
onResume
()
{
protected
void
onResume
()
{
super
.
onResume
();
super
.
onResume
();
SystemRequirementsChecker
.
checkWithDefaultDialogs
(
this
);
beaconManager
.
connect
(
new
BeaconManager
.
ServiceReadyCallback
()
{
@Override
public
void
onServiceReady
()
{
String
msg
=
"Beacons: start scanning..."
;
PositionText
.
setText
(
msg
);
Log
.
d
(
TAG
,
msg
);
beaconManager
.
startRanging
(
region
);
}
});
}
}
@Override
@Override
protected
void
onPause
()
{
protected
void
onPause
()
{
beaconManager
.
stopRanging
(
region
);
super
.
onPause
();
super
.
onPause
();
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment