diff --git a/examples/platform_services/android/app/src/androidTest/java/com/example/flutter/ExampleInstrumentedTest.java b/examples/platform_services/android/app/src/androidTest/java/com/example/flutter/ExampleInstrumentedTest.java index 2fc8eebe99..c8dd7a9c41 100644 --- a/examples/platform_services/android/app/src/androidTest/java/com/example/flutter/ExampleInstrumentedTest.java +++ b/examples/platform_services/android/app/src/androidTest/java/com/example/flutter/ExampleInstrumentedTest.java @@ -8,12 +8,8 @@ import android.support.test.runner.AndroidJUnit4; import io.flutter.view.FlutterView; import android.app.Instrumentation; -import android.support.test.InstrumentationRegistry; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; -import org.json.JSONException; -import org.json.JSONObject; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -23,8 +19,8 @@ import static org.junit.Assert.*; @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Rule - public ActivityTestRule activityRule = - new ActivityTestRule<>(ExampleActivity.class); + public ActivityTestRule activityRule = + new ActivityTestRule<>(MainActivity.class); @Test diff --git a/examples/platform_services/android/app/src/main/AndroidManifest.xml b/examples/platform_services/android/app/src/main/AndroidManifest.xml index b068bdc9d7..d18170ba48 100644 --- a/examples/platform_services/android/app/src/main/AndroidManifest.xml +++ b/examples/platform_services/android/app/src/main/AndroidManifest.xml @@ -10,7 +10,7 @@ = VERSION_CODES.LOLLIPOP) { BatteryManager batteryManager = (BatteryManager) getSystemService(BATTERY_SERVICE); @@ -50,10 +54,6 @@ public class ExampleActivity extends FlutterActivity { intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1); } - if (batteryLevel != -1) { - response.success(batteryLevel); - } else { - response.error("UNAVAILABLE", "Battery level not available.", null); - } + return batteryLevel; } }