Начал добавлять запросы на регистрацию, валидацию, удаление токена кассы
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
additional functionality it is fine to subclass or reimplement
|
||||
FlutterApplication and put your custom class here. -->
|
||||
<application android:name="io.flutter.app.FlutterApplication" android:label="checker" android:icon="@mipmap/ic_launcher">
|
||||
<activity android:name=".MainActivity"
|
||||
<activity android:name="com.dinnect.checker.activity.MainActivity"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@android:style/Theme.Black.NoTitleBar"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection"
|
||||
@@ -30,7 +30,12 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name=".CameraActivity"
|
||||
<activity android:name="com.dinnect.checker.activity.CameraActivity"
|
||||
android:theme="@android:style/Theme.Black.NoTitleBar"/>
|
||||
|
||||
<service
|
||||
android:name="com.dinnect.checker.service.RegistrationIntentService"
|
||||
android:exported="false"/>
|
||||
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.dinnect.checker;
|
||||
package com.dinnect.checker.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.pm.ActivityInfo;
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.dinnect.checker.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import com.dinnect.checker.activity.CameraActivity;
|
||||
import com.dinnect.checker.service.RegistrationIntentService;
|
||||
|
||||
import io.flutter.app.FlutterActivity;
|
||||
import io.flutter.plugins.GeneratedPluginRegistrant;
|
||||
|
||||
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.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;
|
||||
|
||||
@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 MethodCallHandler() {
|
||||
@Override
|
||||
public void onMethodCall(MethodCall call, Result result) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.dinnect.checker.service;
|
||||
|
||||
import android.app.IntentService;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.widget.Toast;
|
||||
import com.google.android.gms.iid.InstanceID;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class RegistrationIntentService extends IntentService {
|
||||
|
||||
public RegistrationIntentService() {
|
||||
super(RegistrationIntentService.class.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onHandleIntent(@Nullable Intent intent) {
|
||||
InstanceID instanceID = InstanceID.getInstance(this);
|
||||
String token = instanceID.getId();
|
||||
Log.d("kifio", token);
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package com.dinnect.checker;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import com.dinnect.checker.CameraActivity;
|
||||
|
||||
import io.flutter.app.FlutterActivity;
|
||||
import io.flutter.plugins.GeneratedPluginRegistrant;
|
||||
|
||||
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;
|
||||
|
||||
public class MainActivity extends FlutterActivity {
|
||||
|
||||
private static final String CHANNEL = "com.dinnect.checker/scanner";
|
||||
|
||||
@Override
|
||||
protected 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) {
|
||||
Log.d("kifio", "onMethodCall");
|
||||
startActivity(new Intent(MainActivity.this, CameraActivity.class));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void startScanner() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user