Skip to content

Commit

Permalink
Removed pre-acquired wake lock by default and added warning about par…
Browse files Browse the repository at this point in the history
…tial wake lock for beep
  • Loading branch information
darryncampbell committed Apr 21, 2017
1 parent 27e3d82 commit f6b0ce9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Application/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ android {
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

Expand Down Expand Up @@ -63,7 +64,7 @@ protected void onCreate(Bundle savedInstanceState) {
WAKE_LOCK_TAG_2);

// Uncomment this line to acquire a wake lock without user intervention
acquireWakeLock(wakeLock2);
//acquireWakeLock(wakeLock2);

configureBatteryOptimisation(false);

Expand Down Expand Up @@ -206,6 +207,13 @@ void startBackgroundService()
timeout = 10000;
else if (spinnerTimeout.getSelectedItemId() == 2)
timeout = 20000;
// Because the beep holds a wake lock, do not allow this to proceed with 1 second
if (bBeep && timeout == 1000)
{
Toast.makeText(this, "Beep holds a partial wake lock for a few seconds after each beep therefore this configuration is not advised", Toast.LENGTH_LONG).show();
disableUIElements(false);
return;
}
MyIntentService.shouldContinue = true;
Intent msgIntent = new Intent(MainActivity.this, MyIntentService.class);
// msgIntent.putExtra(MyIntentService.REQUEST_POST_ADDRESS, "http://192.168.0.2:8082/script.php");
Expand Down

0 comments on commit f6b0ce9

Please sign in to comment.