-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Build release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- v* | ||
|
||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 12 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '12' | ||
distribution: 'adopt' | ||
cache: gradle | ||
- name: Build with Gradle | ||
run: | | ||
gradle --version | ||
gradle wrapper | ||
./gradlew clean assembleDebug | ||
- run: tree | ||
- name: Archive builds | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: app-debug-apk | ||
path: '**/apk-debug.apk' |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,78 @@ | ||
# android_automaton_app | ||
# ClearBluetooth | ||
Simple app that will remove all bluetooth pairings with a push of a button or from command line using `adb` | ||
<br><br/> | ||
## Building and installation for Android 11 or lower | ||
Application can be installed by building it in Android Studio or from command line | ||
|
||
Building from command line. This will build and install the application to connected device | ||
```bash | ||
./gradlew installDebug | ||
> BUILD SUCCESSFUL | ||
``` | ||
|
||
Build application without installing | ||
```bash | ||
./gradlew assembleDebug | ||
> BUILD SUCCESSFUL | ||
``` | ||
|
||
Both command will build application. Built `.apk` is located in | ||
```bash | ||
app/build/outputs/apk/debug/app-debug.apk | ||
``` | ||
<br><br/> | ||
## Building and installation for Android 12 | ||
Download the `apk` from the releases or build it by using ide or gradle | ||
```bash | ||
./gradlew assembleDebug | ||
> BUILD SUCCESSFUL | ||
``` | ||
Android 12 has stricter permission control. Either install with `-g` flag: | ||
```bash | ||
adb install -g path/to/apk | ||
``` | ||
- `-g` will allow all the run time permissions | ||
|
||
### `If installed without -g user has to allow bluetooth permissions. The permission is asked only once on the initial launch of the app. If denied, uninstall the application and reinstall to have permissions asked again` | ||
<br><br/> | ||
## Possible problems | ||
|
||
```bash | ||
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain | ||
Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain | ||
``` | ||
|
||
Run | ||
```bash | ||
gradle wrapper | ||
``` | ||
<br><br/> | ||
## Using the application | ||
The application has two activities: | ||
- MainActivity | ||
- UnpairWithoutUI | ||
|
||
`MainActivity` is the one that has the UI and opens up when application is launched from the phone. `UnpairWithoutUI` will | ||
run without UI and close after pairings are removed. | ||
|
||
To clear the bluetooth pairings from the command line. Install the application and run the `UnpairWithoutUI` | ||
```bash | ||
adb shell am start -n com.automationdev.clearbluetooth/.UnpairWithoutUI | ||
``` | ||
|
||
To enable/disable devices's bluetooth connection | ||
```bash | ||
adb shell am start -n com.automationdev.clearbluetooth/.ToggleBluetooth -e bluetooth enable/disable | ||
``` | ||
<br><br/> | ||
## Logging | ||
When running unpairing from command line the application will output how many devices were paired and how many the app was able to unpair. | ||
These prints can be found from log. Grep with the name of the activity `W UnpairWithoutUI` | ||
```bash | ||
adb logcat | grep "W UnpairWithoutUI" | ||
> ... W UnpairWithoutUI: There is currently 7 paired bluetooth devices. | ||
> ... W UnpairWithoutUI: 7 of 7 devices un-paired. | ||
``` | ||
<br><br/> | ||
## Release | ||
Create a Github release and use `v` at the beginning of tag (for example `v1.0`). `.apk` is added to the release artefacts automatically. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
plugins { | ||
id 'com.android.application' | ||
id 'kotlin-android' | ||
} | ||
|
||
android { | ||
compileSdk 31 | ||
|
||
defaultConfig { | ||
applicationId "com.automationdev.clearbluetooth" | ||
minSdk 24 | ||
targetSdk 31 | ||
versionCode 1 | ||
versionName "1.0.0" | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
kotlinOptions { | ||
jvmTarget = '1.8' | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation 'androidx.core:core-ktx:1.7.0' | ||
implementation 'androidx.appcompat:appcompat:1.4.0' | ||
implementation 'com.google.android.material:material:1.4.0' | ||
implementation 'androidx.constraintlayout:constraintlayout:2.1.2' | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |