adding Android ReactPlugin

Summary:
Adding a a react-devtools plugin for Android.
This doesn't do much, but announces the plugin to be available.
To make this work on remote device, the hostname and port sent to the device needs to be set in the dev tools. This is isn't done yet, so this will only work for simulators.

Reviewed By: jknoxville

Differential Revision: D12897151

fbshipit-source-id: b874549925c395ff6356f6745b9706b182d544dd
This commit is contained in:
Daniel Büchele
2018-12-04 03:35:43 -08:00
committed by Facebook Github Bot
parent 5a9d92c786
commit d331ec2f10

View File

@@ -0,0 +1,49 @@
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
*/
package com.facebook.flipper.plugins.react;
import android.support.annotation.Nullable;
import com.facebook.flipper.core.FlipperConnection;
import com.facebook.flipper.core.FlipperObject;
import com.facebook.flipper.core.FlipperPlugin;
import com.facebook.flipper.core.FlipperReceiver;
import com.facebook.flipper.core.FlipperResponder;
public class ReactFlipperPlugin implements FlipperPlugin {
public static final String ID = "React";
@Nullable private FlipperConnection mConnection;
@Override
public String getId() {
return ID;
}
@Override
public void onConnect(FlipperConnection connection) {
mConnection = connection;
connection.receive(
"config",
new FlipperReceiver() {
@Override
public void onReceive(final FlipperObject params, FlipperResponder responder) {
// set received host and port in react-native
}
});
}
@Override
public void onDisconnect() {
mConnection = null;
}
@Override
public boolean runInBackground() {
return true;
}
}