Skip to content

Instantly share code, notes, and snippets.

@happyharis
Last active January 11, 2019 07:37
Show Gist options
  • Select an option

  • Save happyharis/d4df392cb87672ebfe29d79ecd7a554a to your computer and use it in GitHub Desktop.

Select an option

Save happyharis/d4df392cb87672ebfe29d79ecd7a554a to your computer and use it in GitHub Desktop.
import io.flutter.app.FlutterActivity;
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 com.uxcam.UXCam; // Make sure you have this import
public class MainActivity extends FlutterActivity {
// The methodChannel object name created in the UXCam file
private static final String CHANNEL = "com.ur.app/uxcam";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GeneratedPluginRegistrant.registerWith(this);
new MethodChannel(getFlutterView(), CHANNEL).setMethodCallHandler(new MethodCallHandler() {
@Override
public void onMethodCall(MethodCall call, Result result) {
if (call.method.equals("init")) {
String apiKey = call.argument("apiKey");
UXCam.startWithKey(apiKey);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment