You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tip: From v2.1.0 supported Umeng "Compliance Guide" AndroidIOS, and made appropriate adjustments to facilitate integration.
Note: The following document description shall prevail, do not refer to the settings in the example
Usages
Import
dependencies:
umeng_analytics_push: ^x.x.x #The latest version is shown above, plugin1.x supports flutter1.x, plugin2.x supports flutter2.x# Or import through Git (choose one, Git version may be updated more timely)dependencies:
umeng_analytics_push:
git:
url: https://github.com/zileyuan/umeng_analytics_push.git
packagecom.demo.umeng.appimportandroid.os.Handlerimportandroid.os.Looperimportandroid.content.Intentimportandroidx.annotation.NonNull;importio.flutter.embedding.android.FlutterActivityimportio.flutter.embedding.engine.FlutterEngineimportio.flutter.plugins.GeneratedPluginRegistrantimportio.github.zileyuan.umeng_analytics_push.UmengAnalyticsPushFlutterAndroidimportio.github.zileyuan.umeng_analytics_push.UmengAnalyticsPushPluginclassMainActivity: FlutterActivity() {
var handler:Handler=Handler(Looper.myLooper())
overridefunconfigureFlutterEngine(@NonNull flutterEngine:FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
}
overridefunonNewIntent(intent:Intent) {
// Actively update and save the intent every time you go back to the front desk, and then you can get the latest intent
setIntent(intent);
super.onNewIntent(intent);
}
overridefunonResume() {
super.onResume()
UmengAnalyticsPushFlutterAndroid.androidOnResume(this)
if (getIntent().getExtras() !=null) {
var message = getIntent().getExtras().getString("message")
if (message !=null&& message !="") {
// To start the interface, wait for the engine to load, and send it to the interface with a delay of 5 seconds
handler.postDelayed(object:Runnable {
overridefunrun() {
UmengAnalyticsPushPlugin.eventSink.success(message)
}
}, 5000)
}
}
}
overridefunonPause() {
super.onPause()
UmengAnalyticsPushFlutterAndroid.androidOnPause(this)
}
}
Initialize Umeng, call it after agreeing to the "Privacy Policy" according to the "Compliance Guide", two parameter switches, one is log, the other is push