Also support lower android version
This commit is contained in:
parent
eb3afb0057
commit
3e5101aab8
3 changed files with 28 additions and 10 deletions
|
|
@ -5,8 +5,8 @@ android {
|
||||||
compileSdk rootProject.ext.compileSdkVersion
|
compileSdk rootProject.ext.compileSdkVersion
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "org.mapcomplete"
|
applicationId "org.mapcomplete"
|
||||||
minSdkVersion rootProject.ext.minSdkVersion
|
minSdk 30
|
||||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
targetSdkVersion targetSdkVersion
|
||||||
versionCode 9
|
versionCode 9
|
||||||
versionName "debug"
|
versionName "debug"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<uses-sdk tools:overrideLibrary="com.getcapacitor.android, capacitor.cordova.android.plugins" />
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
|
|
||||||
|
|
@ -79,16 +79,33 @@ public class MainActivity extends BridgeActivity {
|
||||||
Databridge.sendAnswerTo(responder, json);
|
Databridge.sendAnswerTo(responder, json);
|
||||||
});
|
});
|
||||||
|
|
||||||
getOnBackInvokedDispatcher().registerOnBackInvokedCallback(OnBackInvokedDispatcher.PRIORITY_OVERLAY,
|
|
||||||
() -> {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||||
System.out.println("Back button pressed");
|
getOnBackInvokedDispatcher().registerOnBackInvokedCallback(OnBackInvokedDispatcher.PRIORITY_OVERLAY,
|
||||||
if (this.backbutton != null) {
|
() -> {
|
||||||
Databridge.sendAnswerTo(this.backbutton, "backbutton pressed");
|
System.out.println("Back button pressed");
|
||||||
|
if (this.backbutton != null) {
|
||||||
|
Databridge.sendAnswerTo(this.backbutton, "backbutton pressed");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
);
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
|
||||||
|
System.out.println("Back button pressed (old)");
|
||||||
|
if (this.backbutton != null) {
|
||||||
|
Databridge.sendAnswerTo(this.backbutton, "backbutton pressed");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
super.onBackPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private boolean hasGeolocationPermission() {
|
private boolean hasGeolocationPermission() {
|
||||||
return ContextCompat.checkSelfPermission(
|
return ContextCompat.checkSelfPermission(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue