Merge pull request #3034 from jason-simmons/gradle_flx_refresh
Support "flutter refresh" in the Gradle-based sample project
This commit is contained in:
@@ -6,6 +6,8 @@ package com.example.flutter;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.location.Location;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Bundle;
|
||||
@@ -76,6 +78,20 @@ public class ExampleActivity extends Activity {
|
||||
flutterView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
// Reload the Flutter Dart code when the activity receives an intent
|
||||
// from the "flutter refresh" command.
|
||||
// This feature should only be enabled during development. Use the
|
||||
// debuggable flag as an indicator that we are in development mode.
|
||||
if ((getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
|
||||
if (Intent.ACTION_RUN.equals(intent.getAction())) {
|
||||
flutterView.runFromBundle(intent.getDataString(),
|
||||
intent.getStringExtra("snapshot"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void sendGetRandom() {
|
||||
JSONObject message = new JSONObject();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user