fs_anti_theft_flutter 1.1.20+22 fs_anti_theft_flutter: ^1.1.20+22 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: 1.0.10+28
Add source cocoapods in your /iOS/Podfile
file
pod 'FSAntiTheftSDK',:git=>'git@int-repository.whitelabel.com.br:mobile/ios/libs/anti-theft-sdk-ios.git', :branch => 'main'
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 "https://artifactory-hc.whitelabel.com.br/artifactory/gradle-release-local/"
credentials{
username = "dev"
password = "1q2w3e"
}
authentication {
basic(BasicAuthentication)
}
}
}
}
Add in dependencies in your /android/app/build.gradle
file
dependencies {
implementation "br.com.vistoriaremota.app:antitheftsdk:1.1.20"
}
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":"example.com.br",
"APPLICATION_ID": "example",
"ANTI_THEFT_API_KEY": "example",
"VERSION_NAME": "",
"EMAIL": "example@gmail.com",
"MOBILE": "99 9999-9999",
"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)