init static method
Initialize plugin with configurations.
androidKey
is for android app key.
iosKey
is for ios app key.
channel
is distribution for this app, can leave it empty.
logEnabled
turn on or off log, default for false.
encryptEnabled
turn on or off log encrypt, default for false.
sessionContinueMillis
time in milliseconds to upload analytics data.
catchUncaughtExceptions
whether to catch uncaught exceptions, default for true.
pageCollectionMode
how to collect page data, leave it AUTO is ok, for future details, read umeng doc.
Implementation
///
/// [androidKey] is for android app key.
/// [iosKey] is for ios app key.
/// [channel] is distribution for this app, can leave it empty.
/// [logEnabled] turn on or off log, default for false.
/// [encryptEnabled] turn on or off log encrypt, default for false.
/// [sessionContinueMillis] time in milliseconds to upload analytics data.
/// [catchUncaughtExceptions] whether to catch uncaught exceptions, default for true.
/// [pageCollectionMode] how to collect page data, leave it AUTO is ok, for future details, read umeng doc.
static Future<bool?> init({
required String androidKey,
required String iosKey,
String? channel,
bool logEnabled = false,
bool encryptEnabled = false,
int sessionContinueMillis = 30000,
bool catchUncaughtExceptions = true,
String pageCollectionMode = 'AUTO',
}) async {
Map<String, dynamic> map = {
'androidKey': androidKey,
'iosKey': iosKey,
'channel': channel,
'logEnabled': logEnabled,
'encryptEnabled': encryptEnabled,
'sessionContinueMillis': sessionContinueMillis,
'catchUncaughtExceptions': catchUncaughtExceptions,
'pageCollectionMode': pageCollectionMode,
};
return DemonPlugin.methodChannel.invokeMethod<bool>('initUmengAnalytics', map);
}