This also touches parts of the app not only used for bangle.js.
E.g. pending intents gets new flags from SDK 23 inclusive.
Bluetooth permissions are updated to work on SDK 31.
Permission handling is updated to the new way for doing it with
introduction of a new function. This is called for newer sdk versions.
bump Bangle.js flavor targetSdkVersion to 31
update comments re SDK 31
set the 'exported=true' I introduced to false instead - except for three places
add uses-permission for handling bluetooth in order to work on api >30
add if-blocks adding FLAG_IMMUTABLE to PendingIntents on api >30
add link to bluetooth documentation
Add comment to banglejs manifest. Add requirement annotation to ControlCenterv
bump compileSdkVersion to 31
add "OpenAppSettings" permission popup while working out individual permission popups on android 13
if SDK < 31 do permissions one by one, else send user to app info page to switch permissions manually
working solution, but needs cleaning
do some cleaning, not done though
remove some logging
remove import Log
tweak and remove toasts in new permissions handling
Change conditions `> Build.VERSION_CODES.Q` to `>= Build.VERSION_CODES.R` matching the style used everywhere else
Revert "Change conditions `> Build.VERSION_CODES.Q` to `>= Build.VERSION_CODES.R` matching the style used everywhere else"
This reverts commit 2929629ff43fbb685eb3d15e42459f321f68fa11.
Revert "add if-blocks adding FLAG_IMMUTABLE to PendingIntents on api >30"
This reverts commit ed8e1df7bb8b71fee745fbf9d10747d47c8f6cb8.
Pending intents gets `PendingIntent.FLAG_IMMUTABLE` if `(Build.VERSION.SDK_INT >= Build.VERSION_CODES.R)`.
Bangle.js: undo `@RequiresApi` code R
... to remove error in Android Studio where declared required api was
higher then minSDK version.
Use FLAG_MUTABLE for reply to test notification
This should fix Gadgetbridge crashing when replying to the test
notification from the debug activity. As reported here:
https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/2924#issuecomment-917282
Change to use FLAG_IMMUTABLE/_MUTABLE from SDK 23
... as suggested by Android Studio. This is supposed to make the app
more secure by not allowing certain changes to pending intents where
they are not expected. If I understood correctly.
Add PendingIntentUtils class to manage mutability
Add support for (explicit) service intents.
Add support for setting flags for intents.
Add support for setting multiple categories for intents.
Add ability for Gadgetbridge to wake the Android device and leave the
lock screen to start activities when it is sleeping. A new activity
'WakeActivity' is used for this. (Must use 'trusted device' in Android)
Add dismiss-button to 'display over other apps' permission pop up.
Bangle.js can send "gadgetbridge" as package info to accomodate the
different GB build variants/flavours.
Use only getContext() and not getApplicationContext() when executing
the intents.
This PR adds build flavors to `build.gradle`. The default is called `main`, but we also add `banglejs` which allows the building of an app called `Bangle.js Gadgetbridge`.
This will have internet connectivity, allowing Bangle.js watches to request data directly from the internet - and it's named so as hopefully not to be confused with the normal offline Gadgetbridge, while still giving credit.
Eventually the plan is to put this on the Google Play store, and to have additions in it which are good for Bangle.js users but would otherwise negatively impact normal Gadgetbridge users (a build flavor is used so we can keep the same codebase and not fork).
About naming - I'd mentioned `Gadgetbridge for Bangle` to @ashimokawa but thinking about how it would appear in the app store and Android apps list, it probably makes sense to call it `Bangle.js Gadgetbridge` so it's listed under `B...`. Happy to change or use something else if you have strong opinions though.
**Note:** adding build flavors seems to add the flavor name to existing builds. As a result, *all other builds will now have `main` in the name*. Unfortunately I didn't see another way around this, but hopefully it won't break anything.
Co-authored-by: Gordon Williams <gw@pur3.co.uk>
Reviewed-on: https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/2621
Co-authored-by: gfwilliams <gfwilliams@noreply.codeberg.org>
Co-committed-by: gfwilliams <gfwilliams@noreply.codeberg.org>