MrLiuYS / lcfarm_flutter_umeng

flutter 友盟统计

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lcfarm_flutter_umeng

A new flutter plugin project.

Getting Started

android项目需要在MainActivity.java添加方法

public void onResume() {
  super.onResume();
  MobclickAgent.onResume(this);

}

public void onPause() {
  super.onPause();
  MobclickAgent.onPause(this);
}

当然记得引入

import com.umeng.analytics.MobclickAgent;

android的获取权限

<manifest ...>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application ...>

android 多渠道

没有配置参数 channel . 则需要修改 Androidmanifest.xml

修改${CHANNEL_NAME}

<manifest ...>

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <uses-permission android:name="android.permission.INTERNET"/>

    <application ...>
        ...
        <meta-data
            android:name="UMENG_CHANNEL"
            android:value="${CHANNEL_NAME}" />
    </application>
</manifest>

使用了多渠道打包。需要修改app/build.gradle

manifestPlaceholders = [
  CHANNEL_NAME: "默认渠道名",
]

About

flutter 友盟统计

License:Other


Languages

Language:Java 32.0%Language:Ruby 26.6%Language:Dart 21.3%Language:Objective-C 17.4%Language:Swift 2.7%