Реализовано получение токена кассы

This commit is contained in:
Ivan Murashov
2017-07-18 09:43:00 +03:00
parent 79a16fb81f
commit fc07eca469
4 changed files with 54 additions and 57 deletions

View File

@@ -18,44 +18,41 @@ import com.google.android.gms.iid.InstanceID;
public class MainActivity extends FlutterActivity {
private static final String SCANNER_CHANNEL = "com.dinnect.checker";
// private static final String INSTANCE_ID_CHANNEL = "com.dinnect.checker/instance_id";
private String mInstanceID = null;
private static final String INSTANCE_ID_CHANNEL = "com.dinnect.checker/instance_id";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GeneratedPluginRegistrant.registerWith(this);
// new MethodChannel(getFlutterView(), INSTANCE_ID_CHANNEL).setMethodCallHandler(
// new MethodCallHandler() {
// @Override
// public void onMethodCall(MethodCall call, Result result) {
//
// }
// });
new MethodChannel(getFlutterView(), SCANNER_CHANNEL).setMethodCallHandler(
new MethodChannel(getFlutterView(), INSTANCE_ID_CHANNEL).setMethodCallHandler(
new MethodCallHandler() {
@Override
public void onMethodCall(MethodCall call, Result result) {
if (call.method.equals("getInstanceID")) {
InstanceID instanceID = InstanceID.getInstance(MainActivity.this);
String id = instanceID.getId();
if (id != null) {
result.success(id);
} else {
result.error("UNAVAILABLE", "Can't get instanceID.", null);
}
} else {
result.notImplemented();
}
}
});
}
public void startScanner() {
startActivity(new Intent(MainActivity.this, CameraActivity.class));
}
public String getInstanceID() {
if (mInstanceID == null) {
InstanceID instanceID = InstanceID.getInstance(this);
mInstanceID = instanceID.getId();
}
Log.d()
return mInstanceID;
public void getInstanceID() {
}
}