diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7edf823..f61225d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.5.0 - 03 Oct 2021
+
+* Update Android code to remove deprecation warning
+
## 0.4.3 - 15 Sept 2021
* removed debug print statement
diff --git a/README.md b/README.md
index 81cd8d2..2a4c28f 100644
--- a/README.md
+++ b/README.md
@@ -23,6 +23,9 @@ Since GNU/Linux and POSIX doesn't provide a standard API for getting the preferr
## Updates
+### Oct 2021
+Updated the code and APIs used by Flutter for an Android plugin - this was the source of the Deprecated API warning in the Android build.
+
### July 2021
Add beta support for Linux
diff --git a/android/build.gradle b/android/build.gradle
index c9f4500..fee8bd4 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -17,6 +17,15 @@ rootProject.allprojects {
google()
jcenter()
}
+
+ /*
+ gradle.projectsEvaluated {
+ tasks.withType(JavaCompile) {
+ options.compilerArgs << "-Xlint:deprecation"
+ }
+ }
+ */
+
}
apply plugin: 'com.android.library'
diff --git a/android/src/main/java/com/example/devicelocale/DevicelocalePlugin.java b/android/src/main/java/com/example/devicelocale/DevicelocalePlugin.java
index 7f91adc..40d005f 100644
--- a/android/src/main/java/com/example/devicelocale/DevicelocalePlugin.java
+++ b/android/src/main/java/com/example/devicelocale/DevicelocalePlugin.java
@@ -1,14 +1,14 @@
package com.example.devicelocale;
import androidx.annotation.NonNull;
-import androidx.core.os.LocaleListCompat;
+
+import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
-import io.flutter.plugin.common.PluginRegistry.Registrar;
-import io.flutter.embedding.engine.plugins.FlutterPlugin;
-import io.flutter.plugin.common.BinaryMessenger;
+
+import androidx.core.os.LocaleListCompat;
import android.content.Context;
import android.content.ContextWrapper;
import java.util.ArrayList;
@@ -20,36 +20,19 @@
*/
public class DevicelocalePlugin implements MethodCallHandler, FlutterPlugin {
- private Context applicationContext;
- private MethodChannel methodChannel;
-
- /**
- * Plugin registration.
- */
- public static void registerWith(Registrar registrar) {
- final DevicelocalePlugin instance = new DevicelocalePlugin();
- instance.onAttachedToEngine(registrar.context(), registrar.messenger());
- }
+ private MethodChannel channel;
@Override
- public void onAttachedToEngine(FlutterPluginBinding binding) {
- onAttachedToEngine(binding.getApplicationContext(), binding.getBinaryMessenger());
+ public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
+ channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "uk.spiralarm.flutter/devicelocale");
+ channel.setMethodCallHandler(this);
}
@Override
public void onDetachedFromEngine(FlutterPluginBinding binding) {
- applicationContext = null;
- methodChannel.setMethodCallHandler(null);
- methodChannel = null;
+ channel.setMethodCallHandler(null);
}
- private void onAttachedToEngine(Context applicationContext, BinaryMessenger messenger) {
- this.applicationContext = applicationContext;
- methodChannel = new MethodChannel(messenger, "uk.spiralarm.flutter/devicelocale");
- methodChannel.setMethodCallHandler(this);
- }
-
-
@Override
public void onMethodCall(MethodCall call, @NonNull Result result) {
String method = call.method;
diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist
index 9367d48..8d4492f 100644
--- a/example/ios/Flutter/AppFrameworkInfo.plist
+++ b/example/ios/Flutter/AppFrameworkInfo.plist
@@ -21,6 +21,6 @@
CFBundleVersion
1.0
MinimumOSVersion
- 8.0
+ 9.0
diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock
index 4620137..78b4754 100644
--- a/example/ios/Podfile.lock
+++ b/example/ios/Podfile.lock
@@ -15,7 +15,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
devicelocale: b22617f40038496deffba44747101255cee005b0
- Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
+ Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
PODFILE CHECKSUM: 8e679eca47255a8ca8067c4c67aab20e64cb974d
diff --git a/pubspec.yaml b/pubspec.yaml
index 0e94b29..ff9e631 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,6 +1,6 @@
name: devicelocale
description: A Flutter package that can be used to extract the locales that are currently defined on a device with the current locale set as the first in the list.
-version: 0.4.3
+version: 0.5.0
homepage: https://github.com/magnatronus/flutter-devicelocale
environment: