I'm developing a mobile app using Flutter, which will use the Zebra barcode scanner. I need to create and configure a new DataWedge profile when the app initializes. I created the function below using Dart. The first part of the code works—it successfully creates the profile with the correct name—but it doesn't apply any of the configurations I wrote. I've tried many things, but nothing has really worked.
// ignore_for_file: avoid_print
import 'package:android_intent_plus/android_intent.dart';
import 'dart:convert';
void configureDataWedgeProfile() async {
const profileName = "app_coletor";
const packageName = "com.kugel.app_coletor";
const intentAction = "com.kugel.app_coletor.ACTION";
try {
print("Criando perfil do DataWedge...");
await AndroidIntent(
action: "com.symbol.datawedge.api.ACTION",
arguments: {"com.symbol.datawedge.api.CREATE_PROFILE": profileName},
).sendBroadcast();
await Future.delayed(const Duration(seconds: 2));
print("Associando aplicativo ao perfil...");
await AndroidIntent(
action: "com.symbol.datawedge.api.ACTION",
arguments: {
"com.symbol.datawedge.api.SET_CONFIG": jsonEncode({
"PROFILE_NAME": profileName,
"PROFILE_ENABLED": "true",
"CONFIG_MODE": "UPDATE",
"APP_LIST": [
{
"PACKAGE_NAME": packageName,
"ACTIVITY_LIST": ["*"]
}
]
})
},
).sendBroadcast();
await Future.delayed(const Duration(seconds: 2));
print("Configurando o plugin de código de barras...");
await AndroidIntent(
action: "com.symbol.datawedge.api.ACTION",
arguments: {
"com.symbol.datawedge.api.SET_CONFIG": jsonEncode({
"PROFILE_NAME": profileName,
"CONFIG_MODE": "UPDATE",
"PLUGIN_CONFIG": {
"PLUGIN_NAME": "BARCODE",
"RESET_CONFIG": "true",
"PARAM_LIST": {
"scanner_selection": "auto",
"decode_audio_feedback_uri":
"file:///system/media/audio/ui/VideoRecord.ogg"
}
}
})
},
).sendBroadcast();
await Future.delayed(const Duration(seconds: 2));
print("Configurando o plugin de intent...");
await AndroidIntent(
action: "com.symbol.datawedge.api.ACTION",
arguments: {
"com.symbol.datawedge.api.SET_CONFIG": jsonEncode({
"PROFILE_NAME": profileName,
"CONFIG_MODE": "UPDATE",
"PLUGIN_CONFIG": {
"PLUGIN_NAME": "INTENT",
"RESET_CONFIG": "true",
"PARAM_LIST": {
"intent_output_enabled": "true",
"intent_action": intentAction,
"intent_delivery": "2"
}
}
})
},
).sendBroadcast();
print("Perfil do DataWedge configurado e app vinculado!");
} catch (e) {
print("Erro ao configurar o DataWedge: $e");
}
}```
I'm developing a mobile app using Flutter, which will use the Zebra barcode scanner. I need to create and configure a new DataWedge profile when the app initializes. I created the function below using Dart. The first part of the code works—it successfully creates the profile with the correct name—but it doesn't apply any of the configurations I wrote. I've tried many things, but nothing has really worked.
// ignore_for_file: avoid_print
import 'package:android_intent_plus/android_intent.dart';
import 'dart:convert';
void configureDataWedgeProfile() async {
const profileName = "app_coletor";
const packageName = "com.kugel.app_coletor";
const intentAction = "com.kugel.app_coletor.ACTION";
try {
print("Criando perfil do DataWedge...");
await AndroidIntent(
action: "com.symbol.datawedge.api.ACTION",
arguments: {"com.symbol.datawedge.api.CREATE_PROFILE": profileName},
).sendBroadcast();
await Future.delayed(const Duration(seconds: 2));
print("Associando aplicativo ao perfil...");
await AndroidIntent(
action: "com.symbol.datawedge.api.ACTION",
arguments: {
"com.symbol.datawedge.api.SET_CONFIG": jsonEncode({
"PROFILE_NAME": profileName,
"PROFILE_ENABLED": "true",
"CONFIG_MODE": "UPDATE",
"APP_LIST": [
{
"PACKAGE_NAME": packageName,
"ACTIVITY_LIST": ["*"]
}
]
})
},
).sendBroadcast();
await Future.delayed(const Duration(seconds: 2));
print("Configurando o plugin de código de barras...");
await AndroidIntent(
action: "com.symbol.datawedge.api.ACTION",
arguments: {
"com.symbol.datawedge.api.SET_CONFIG": jsonEncode({
"PROFILE_NAME": profileName,
"CONFIG_MODE": "UPDATE",
"PLUGIN_CONFIG": {
"PLUGIN_NAME": "BARCODE",
"RESET_CONFIG": "true",
"PARAM_LIST": {
"scanner_selection": "auto",
"decode_audio_feedback_uri":
"file:///system/media/audio/ui/VideoRecord.ogg"
}
}
})
},
).sendBroadcast();
await Future.delayed(const Duration(seconds: 2));
print("Configurando o plugin de intent...");
await AndroidIntent(
action: "com.symbol.datawedge.api.ACTION",
arguments: {
"com.symbol.datawedge.api.SET_CONFIG": jsonEncode({
"PROFILE_NAME": profileName,
"CONFIG_MODE": "UPDATE",
"PLUGIN_CONFIG": {
"PLUGIN_NAME": "INTENT",
"RESET_CONFIG": "true",
"PARAM_LIST": {
"intent_output_enabled": "true",
"intent_action": intentAction,
"intent_delivery": "2"
}
}
})
},
).sendBroadcast();
print("Perfil do DataWedge configurado e app vinculado!");
} catch (e) {
print("Erro ao configurar o DataWedge: $e");
}
}```
Share
Improve this question
asked Feb 17 at 11:55
Otávio Luiz NandiOtávio Luiz Nandi
515 bronze badges
New contributor
Otávio Luiz Nandi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1 Answer
Reset to default 3Solved! It seems the issue was with the AndroidIntentPlus package. I tried using the FlutterDataWedge package instead, and it worked. The code barely changed...
import 'package:flutter_datawedge/flutter_datawedge.dart';
void configureDataWedgeProfile() async {
const String profileName = "app_coletor";
const String packageName = "com.kugel.app_coletor";
const String intentAction = "com.kugel.app_coletor.ACTION";
try {
await FlutterDataWedge().createDefaultProfile(profileName: profileName);
await Future.delayed(const Duration(seconds: 1));
await FlutterDataWedge().updateProfile(
profileName: profileName,
pluginName: "APP_LIST",
config: {
"PROFILE_NAME": profileName,
"PROFILE_ENABLED": "true",
"CONFIG_MODE": "UPDATE",
"APP_LIST": [
{
"PACKAGE_NAME": packageName,
"ACTIVITY_LIST": ["*"]
}
]
},
);
await Future.delayed(const Duration(seconds: 1));
await FlutterDataWedge().updateProfile(
profileName: profileName,
pluginName: "BARCODE",
config: {
"PROFILE_NAME": profileName,
"CONFIG_MODE": "UPDATE",
"PLUGIN_CONFIG": {
"PLUGIN_NAME": "BARCODE",
"RESET_CONFIG": "true",
"PARAM_LIST": {
"scanner_selection": "auto",
"decode_audio_feedback_uri":
"file:///system/media/audio/ui/VideoRecord.ogg"
}
}
},
);
await Future.delayed(const Duration(seconds: 1));
await FlutterDataWedge().updateProfile(
profileName: profileName,
pluginName: "INTENT",
config: {
"PROFILE_NAME": profileName,
"CONFIG_MODE": "UPDATE",
"PLUGIN_CONFIG": {
"PLUGIN_NAME": "INTENT",
"RESET_CONFIG": "true",
"PARAM_LIST": {
"intent_output_enabled": "true",
"intent_action": intentAction,
"intent_delivery": "2"
}
}
},
);
} catch (e) {
print("Erro ao configurar o DataWedge: $e");
}
}