fs_anti_theft_flutter 1.0.2+1 fs_anti_theft_flutter: ^1.0.2+1 copied to clipboard
Package do antitheft.
Anti Theft Plugin #
Device Security plugin for flutter
Supported platforms #
- iOS
- Android
Prerequisites #
- iOS 13+
- Android API Level 28
Getting Started
#
Add dependecy in your pubspec.yaml
file
dependencies:
fs_anti_theft_flutter:
git:
url: https://bitbucket.org/daffodilsoftware/fs_anti_theft_flutter.git
ref: "8482043"
Add source cocoapods in your /iOS/Podfile
file
pod 'FSAntiTheftSDK',:git=>'https://Raman_Srivastava@bitbucket.org/raman_srivastava/fsantitheftsdk.git', :commit => '42e2b82'
Add keys in your /iOS/Runner/info.plist
file
Sensitive credential data is in repository at example must be accessed via vpn https://repository.whitelabel.com.br/mobile/flutter/libs/flutter-helper-sdk/-/tree/main/example
Add credentials for maven in your /android/build.gradle
file
allprojects {
repositories {
google()
mavenCentral()
maven {
url "http:example"
credentials{
username = "teste"
password = "teste"
}
authentication {
basic(BasicAuthentication)
}
}
}
}
Add in dependencies in your /android/app/build.gradle
file
dependencies {
implementation "br.com.vistoriaremota.app:antitheftsdk:0.2.28"
}
To register device on portal SDK
import 'package:fs_anti_theft_flutter/fs_anti_theft_flutter.dart';
Future<bool> startLoginToSDK() async {
try{
var args = {
"BASE_URL":"teste",
"APPLICATION_ID": "teste",
"ANTI_THEFT_API_KEY": "teste",
"VERSION_NAME": "",
"EMAIL": "teste@gmail.com",
"MOBILE": "5511958781603",
"IMEI": "EXAMPLE_IMEI",
"ANDROID_PACKAGE_NAME": "br.com.fs.fs_anti_theft_flutter_example"
};
var check = await FsAntiTheftPlugin.startLoginToSDK(arguments: args);
print('Anti-theft Registration ${check ? Successful : Failed}');
return check;
} catch (e) {
print('Anti-theft Registration Failed');
}
return false;
}
To check the registration status of device
import 'package:fs_anti_theft_flutter/fs_anti_theft_flutter.dart';
Future<bool> isDeviceRegistered() {
try{
var args = {
"BASE_URL":"https://example.com.br",
"APPLICATION_ID": "",
"ANTI_THEFT_API_KEY": "",
"IMEI": "EXAMPLE_IMEI",
"ANDROID_PACKAGE_NAME": "br.com.fs.fs_anti_theft_flutter_example"
};
var check = await FsAntiTheftPlugin.isDeviceRegistered(arguments: args);
print('Device ${check ? already : not} Registered');
return check;
} catch (e) {
print('Device not Registered');
}
return false;
}
Permission Enum #
enum EnumPermissionsName {
location, // Both android and iOS
camera, // Both android and iOS
adminAccess, // Only for android
screenOverlay, // Only for android
notification, // Only for iOS
accessibility, // Only for android
}
To check all the permissions
import 'package:fs_anti_theft_flutter/fs_anti_theft_flutter.dart';
Future<Map<EnumPermissionsName, bool>> checkAllPermission() async {
var permissionStatus = await FsAntiTheftPlugin.isDeviceRegistered();
return permissionStatus;
}
To check specific permissions
import 'package:fs_anti_theft_flutter/fs_anti_theft_flutter.dart';
Future<bool> checkPermission({
required EnumPermissionsName permissionName,
}) async {
var permissionStatus = await FsAntiTheftPlugin.checkPermission(permissionName: permissionName);
return permissionStatus;
}
To request all the permissions
import 'package:fs_anti_theft_flutter/fs_anti_theft_flutter.dart';
Future<void> requestAllPermission({
bool askAccessibilityPer = true,
}) async {
var permissionStatus = await FsAntiTheftPlugin.requestAllPermission(askAccessibilityPer: true);
}
To request specific permissions
import 'package:fs_anti_theft_flutter/fs_anti_theft_flutter.dart';
Future<void> requestPermission({
required EnumPermissionsName permissionName,
}) async {
var permissionStatus = await FsAntiTheftPlugin.requestPermission(permissionName: permissionName);
}
Funcoes nativas ios e android expostas para serem chamada pelo flutter
enum EnumActions {
alarmOn, // liga o alarme
alarmOff, // desliga o alarme
location, // pega a localização
camera, // liga a camera
remoteLoking, // bloqueia a tela do celular
remoteUnloking, // desbloqueia o celular
remoteLockWithoutOverride, //
remoteWipe, // formata o celular
}
// Exemplo para chamada do alarme
await FsAntiTheftPlugin.actionAntitheft(action: EnumActions.alarmOn)
// Exemplo para desligar o alarme
await FsAntiTheftPlugin.actionAntitheft(action: EnumActions.alarmOff)