Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
5f98166
Updated BTReceiver.java
The-First-King Jan 2, 2026
f40dd69
Updated build.gradle
The-First-King Jan 2, 2026
72fbad9
Updated AndroidManifest.xml
The-First-King Jan 2, 2026
1b8153d
Create android.yml
The-First-King Jan 3, 2026
e922547
Delete app/src/test/java/com/mystro256/autooffbluetooth directory
The-First-King Jan 4, 2026
6109744
Delete app/src/androidTest/java/com/mystro256/autooffbluetooth directory
The-First-King Jan 4, 2026
b0d8336
Update BTReceiver.java
The-First-King Jan 4, 2026
caf6c13
Update BTReceiver.java
The-First-King Jan 4, 2026
574f039
Update AndroidManifest.xml
The-First-King Jan 4, 2026
b426019
Update BTReceiver.java
The-First-King Jan 4, 2026
67e4ce9
Update AndroidManifest.xml
The-First-King Jan 4, 2026
0096817
Update MainActivity.java
The-First-King Jan 4, 2026
ef4d1fc
Update build.gradle
The-First-King Jan 4, 2026
d185094
Update build.gradle
The-First-King Jan 4, 2026
2fb7fa4
Update build.gradle
The-First-King Jan 4, 2026
445671d
Update gradle-wrapper.properties
The-First-King Jan 4, 2026
3f6b1fd
Update gradle-wrapper.properties
The-First-King Jan 4, 2026
d09263e
Update build.gradle
The-First-King Jan 4, 2026
2c9e5b3
Update gradle.properties
The-First-King Jan 4, 2026
84a7e83
Update build.gradle
The-First-King Jan 4, 2026
40972f0
Delete .idea directory
The-First-King Jan 4, 2026
b54b96f
Update AndroidManifest.xml
The-First-King Jan 4, 2026
abd6599
Update BTReceiver.java
The-First-King Jan 4, 2026
5a93bce
Update activity_main.xml
The-First-King Jan 4, 2026
4d3b05b
Update MainActivity.java
The-First-King Jan 4, 2026
3333c53
Update BTReceiver.java
The-First-King Jan 4, 2026
7dd40d6
Update BTReceiver.java
The-First-King Jan 4, 2026
f8b7ffb
Update BTReceiver.java
The-First-King Jan 4, 2026
1fdf282
Update MainActivity.java
The-First-King Jan 4, 2026
76e0775
Delete fastlane/metadata/android directory
The-First-King Jan 5, 2026
a5a3cbc
Update build.gradle
The-First-King Jan 5, 2026
dc7537d
Update AndroidManifest.xml
The-First-King Jan 5, 2026
a688661
Update BTReceiver.java
The-First-King Jan 5, 2026
e2ba9b9
Update MainActivity.java
The-First-King Jan 5, 2026
1f4993c
Create read.md
The-First-King Jan 5, 2026
ccaaab8
Create read.md
The-First-King Jan 5, 2026
9b987b5
Delete app/src/main/java/com/mine directory
The-First-King Jan 5, 2026
1ed216c
Create read.md
The-First-King Jan 5, 2026
0924f31
Add files via upload
The-First-King Jan 5, 2026
47f3a33
Update read.md
The-First-King Jan 5, 2026
14c0385
Delete app/src/main/java/com/mine/autooffbluetooth/read.md
The-First-King Jan 5, 2026
12477c6
Delete app/src/main/java/com/mystro256 directory
The-First-King Jan 5, 2026
f31dc07
Update README.md
The-First-King Jan 5, 2026
74818a3
Update README.md
The-First-King Jan 5, 2026
7bfa3c9
Create release.yml
The-First-King Jan 5, 2026
8a3cab5
Create full_description.txt
The-First-King Jan 6, 2026
588ca95
Create short_description.txt
The-First-King Jan 6, 2026
4853cea
Create title.txt
The-First-King Jan 6, 2026
27ed713
Update full_description.txt
The-First-King Jan 6, 2026
4a61616
Update short_description.txt
The-First-King Jan 6, 2026
d2ea4cd
Update title.txt
The-First-King Jan 6, 2026
ecb424f
Create read.md
The-First-King Jan 6, 2026
39972ab
Add files via upload
The-First-King Jan 6, 2026
cc8cf30
Delete metadata /en-US/images/read.md
The-First-King Jan 6, 2026
26b935a
Create read.md
The-First-King Jan 6, 2026
5bc4531
Create 1.txt
The-First-King Jan 6, 2026
16964a4
Delete metadata directory
The-First-King Jan 6, 2026
744b486
Create 1.txt
The-First-King Jan 6, 2026
c1e6d70
Add files via upload
The-First-King Jan 6, 2026
c1a7c06
Create read.md
The-First-King Jan 6, 2026
5663f42
Add files via upload
The-First-King Jan 6, 2026
6ebeace
Add files via upload
The-First-King Jan 6, 2026
eac1b4b
Add files via upload
The-First-King Jan 6, 2026
a2ae26f
Delete metadata/en-US/images/phoneScreenshots/read.md
The-First-King Jan 6, 2026
18e3577
Create read.md
The-First-King Jan 6, 2026
6cbc9da
Add files via upload
The-First-King Jan 6, 2026
a360c7c
Delete images/read.md
The-First-King Jan 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Android CI Build APK

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

# Set up JDK
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build Debug APK
run: ./gradlew assembleDebug --no-daemon

- name: Upload Debug APK Artifact
uses: actions/upload-artifact@v4
with:
name: app-debug-apk-from-cloud
path: app/build/outputs/apk/debug/*.apk
57 changes: 57 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Android CI Build Release

on:
push:
tags:
- '[0-9]+.[0-9]+*'
workflow_dispatch:

permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle

- name: Build Release APK
run: ./gradlew assembleRelease

- name: Sign APK
uses: r0adkll/sign-android-release@v1
id: sign_app
with:
releaseDirectory: app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "34.0.0"

- name: Rename and Strip Dots
id: rename_apk
run: |

raw_tag=${GITHUB_REF#refs/tags/}
clean_tag="${raw_tag//./}"
signed_file="${{ steps.sign_app.outputs.signedReleaseFile }}"
new_name="auto-off-bluetooth-${clean_tag}.apk"
mv "$signed_file" "app/build/outputs/apk/release/$new_name"
echo "new_path=app/build/outputs/apk/release/$new_name" >> $GITHUB_OUTPUT

- name: Upload Signed APK to GitHub Release
uses: softprops/action-gh-release@v1
with:
files: ${{ steps.rename_apk.outputs.new_path }}
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 0 additions & 3 deletions .idea/.gitignore

This file was deleted.

29 changes: 0 additions & 29 deletions .idea/codeStyles/Project.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/compiler.xml

This file was deleted.

40 changes: 0 additions & 40 deletions .idea/jarRepositories.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/misc.xml

This file was deleted.

38 changes: 30 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
# autooffbluetooth
A simple Android app to automatically turn off bluetooth if disconnected.
# Auto Off Bluetooth

No configuration, should work as-is, no guarentees and might need you to disable battery optimization for the app. For recent versions of android, it seems to need to be launched at least once for it to work.
Auto Off Bluetooth is a lightweight utility for Android designed to preserve battery life and increase device security. The app monitors your Bluetooth connection status and automatically turns off the Bluetooth radio after 20 seconds if no devices are connected.

If BT is disconnected and reconnected quickly, the app will avoid disabling unnecessarily.
## How it works

[<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png"
alt="Get it on F-Droid"
height="80">](https://f-droid.org/packages/com.mystro256.autooffbluetooth/)
The app listens for Bluetooth state changes in the stack and for Asynchronous Connection-Less disconnection events in the background. When a device disconnects, the app starts a timer. If the timer expires without a reconnection, the app automatically disables the Bluetooth adapter to save power. If a Bluetooth device reconnects, the app postpones the Auto Off task until the next disconnect.

## Screenshots

Use at your own risk, all code is licensed GPLv3, see [LICENSE file](https://github.com/Mystro256/autooffbluetooth/blob/master/LICENSE) for details.
<div align="center">
<img src="https://github.com/The-First-King/Auto-Off-Bluetooth/blob/master/metadata/en-US/images/phoneScreenshots/01.png?raw=true" alt="App UI" width="405" />
</div>

## Permissions

The app requires the following permissions to manage your Bluetooth hardware:

* `BLUETOOTH`: Allows the app to see the status of connections.
* `BLUETOOTH_ADMIN`: Allows the app to toggle the Bluetooth radio on/off.
* `BLUETOOTH_CONNECT`: To interact with paired devices (required for Android 12+).

## Installation & License

<a href="https://github.com/The-First-King/Auto-Off-Bluetooth/releases"><img src="images/GitHub.png" alt="Get it on GitHub" height="60"></a>
<a href="https://apt.izzysoft.de/packages/com.mine.autooffbluetooth"><img src="images/IzzyOnDroid.png" alt="Get it at IzzyOnDroid" height="60"></a>

---

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

---
37 changes: 26 additions & 11 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,28 +1,43 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 28
// Required to support Android 12+ Bluetooth features
compileSdkVersion 31

defaultConfig {
applicationId "com.mystro256.autooffbluetooth"
applicationId "com.mine.autooffbluetooth"
minSdkVersion 15
targetSdkVersion 28
versionCode 5
versionName "1.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
targetSdkVersion 31
versionCode 6
versionName "1.5"

// Updated for AndroidX testing
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

// Required for AGP 7.0+
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

// MIGRATED TO ANDROIDX: Replacements for com.android.support libraries
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'

// Testing dependencies updated for AndroidX
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

This file was deleted.

23 changes: 16 additions & 7 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mystro256.autooffbluetooth">
package="com.mine.autooffbluetooth">

<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>

<application
Expand All @@ -13,19 +15,26 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">

<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<receiver android:name=".BTReceiver"

<receiver
android:name=".BTReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.bluetooth.device.action.ACL_DISCONNECT_REQUESTED" />
<action android:name="android.bluetooth.device.action.ACL_CONNECTED" />
<action android:name="android.bluetooth.device.action.ACL_DISCONNECTED" />
<action android:name="android.bluetooth.device.action.ACL_DISCONNECT_REQUESTED" />
<action android:name="android.bluetooth.adapter.action.STATE_CHANGED" />
</intent-filter>
</receiver>
</application>

</manifest>
</manifest>
Loading