diff --git a/README.md b/README.md
index 2a6a2e6..fdb4d31 100755
--- a/README.md
+++ b/README.md
@@ -61,6 +61,13 @@ AnalysysAgent.setVisitorConfigURL(context, CONFIG_URL);
```
+3.可视化埋点功能
+
+- 在项目根目录文件gradle.properties 设置 Build_Type=visual
+- 运行apidemo项目,启动后进入可视化demo入口
+- 打开 https://growth.analysys.cn/project-management/visual-choice 左上角选中电商Demo,选Android平台
+- 在app打开的情况下摇一摇,设备连接成功后点击设备进入埋点界面
+- 点击View添加事件,点击右下方部署下发配置
diff --git a/ans-demo/apidemo/build.gradle b/ans-demo/apidemo/build.gradle
index 505d1d7..feaac6b 100644
--- a/ans-demo/apidemo/build.gradle
+++ b/ans-demo/apidemo/build.gradle
@@ -48,6 +48,8 @@ android {
signingConfig signingConfigs.release
}
}
+ //repositories { maven { url "https://maven.aliyun.com/repository/google" } }
+
}
@@ -64,6 +66,12 @@ android {
useNewCruncher = false
}
+ repositories {
+ flatDir {
+ dirs 'libs' //this way we can find the .aar file in libs folder
+ }
+ }
+
lintOptions {
checkReleaseBuilds false
abortOnError false
@@ -89,22 +97,23 @@ android {
}
dependencies {
-
+ //implementation fileTree(include: ['*.aar'], dir: 'libs')
if (apidemo_depend.toBoolean()) {
api project(':analysys_arkanalysys')
} else {
api 'cn.com.analysys:analysys-arkanalysys:latest.release'
}
+ //api project(':analysys-tools')
-// api project(':analysys-tools')
-
- api project(':compatibilityDemo')
- api project(':visualDemo')
-
+ //api project(':compatibilityDemo')
+ //implementation(name: 'toolsLibrary', ext: 'aar')
+ //compile files('libs/toolsLibrary-debug.aar')
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.android.material:material:1.0.0'
+ implementation 'androidx.fragment:fragment:1.0.0'
+ compileOnly 'androidx.recyclerview:recyclerview:1.0.0'
}
// 忽略文档编译错误. 设置编码
diff --git a/ans-demo/apidemo/libs/toolsLibrary.aar b/ans-demo/apidemo/libs/toolsLibrary.aar
new file mode 100644
index 0000000..3f23867
Binary files /dev/null and b/ans-demo/apidemo/libs/toolsLibrary.aar differ
diff --git a/ans-demo/apidemo/src/main/AndroidManifest.xml b/ans-demo/apidemo/src/main/AndroidManifest.xml
index b76d4ac..c8123ba 100644
--- a/ans-demo/apidemo/src/main/AndroidManifest.xml
+++ b/ans-demo/apidemo/src/main/AndroidManifest.xml
@@ -6,53 +6,66 @@
android:versionName="1.0">
-
-
+
-
+
-
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+ android:name="com.analysys.demo.Process2Activity"
+ android:process=":process2" />
+ android:value="false" />
-
-
-
-
+ android:value="false" />
\ No newline at end of file
diff --git a/ans-demo/apidemo/src/main/assets/analysys.crt b/ans-demo/apidemo/src/main/assets/analysys.crt
index 05eb1cb..379fe98 100644
--- a/ans-demo/apidemo/src/main/assets/analysys.crt
+++ b/ans-demo/apidemo/src/main/assets/analysys.crt
@@ -1,61 +1,60 @@
-----BEGIN CERTIFICATE-----
-MIIGBTCCBO2gAwIBAgIMXR+tQNcr5HlTR/fLMA0GCSqGSIb3DQEBCwUAMGAxCzAJ
-BgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMTYwNAYDVQQDEy1H
-bG9iYWxTaWduIERvbWFpbiBWYWxpZGF0aW9uIENBIC0gU0hBMjU2IC0gRzIwHhcN
-MTgwODMwMDgzNzI0WhcNMTkxMDE2MDkxNzA5WjA7MSEwHwYDVQQLExhEb21haW4g
-Q29udHJvbCBWYWxpZGF0ZWQxFjAUBgNVBAMMDSouYW5hbHlzeXMuY24wggEiMA0G
-CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDNd+iI8yTeRDlllxyr55Zphc0oWtmV
-qiXjHfXr2a1C8Zh8JKSb6DI1CNLnlhTeNMjDQOHiy3CI1tExHK07ml04+nFo5Og8
-rv8kf2XbgR0tb5JYk8azuGTHTK3xU9uR1B0kQXJ+c9RJow2zaDmZU+hgO/+090R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jMuY3JsMEcGA1UdIARAMD4wPAYEVR0g
+ADA0MDIGCCsGAQUFBwIBFiZodHRwczovL3d3dy5nbG9iYWxzaWduLmNvbS9yZXBv
+c2l0b3J5LzANBgkqhkiG9w0BAQsFAAOCAQEAQgWFTN2WCOZP6FOnizgthtQ3PDrk
+8Q4ueUBYp9H91Gf0hHucnY72cHtshG1iJKqOsLuQ+ewVFtXVEaK1GeJ15Ct9REvY
+skxXwPgRLf/+4/mslqkJhm4jCGWdpuSDf0On0rmSq+N7/daOyaTXqckhd6r+Yx9k
+rs0eI5tgc3p+KcpXhmrwtl5HKoXCkFAtYPIutVuLORlEiTD4mjV4kSeQlaQL/ZQD
+GA9uXqsDj4J/okR7/ruByeEuh8aKWgBSmF7oFasKXPKdTbIS9D9FBPKbYvu1quvI
+/AQsGpQZsvjRJbFu1gU20lhLYYC2PGK8owK23TZjOWglOnuii6MUGwkiMw==
+-----END CERTIFICATE-----
\ No newline at end of file
diff --git a/ans-demo/apidemo/src/main/java/com/analysys/demo/AnsApplication.java b/ans-demo/apidemo/src/main/java/com/analysys/demo/AnsApplication.java
index ab2c2a2..2ab6f61 100644
--- a/ans-demo/apidemo/src/main/java/com/analysys/demo/AnsApplication.java
+++ b/ans-demo/apidemo/src/main/java/com/analysys/demo/AnsApplication.java
@@ -2,14 +2,26 @@
import android.app.Application;
import android.content.Context;
+import android.content.SharedPreferences;
import android.os.StrictMode;
import com.analysys.AnalysysAgent;
import com.analysys.AnalysysConfig;
import com.analysys.EncryptEnum;
import com.analysys.apidemo.BuildConfig;
+import com.analysys.utils.AnalysysSSManager;
import com.analysys.utils.AnsReflectUtils;
+import static com.analysys.demo.ModifyConfigActivity.PREF_FILE;
+import static com.analysys.demo.ModifyConfigActivity.PREF_KEY_APP_KEY;
+import static com.analysys.demo.ModifyConfigActivity.PREF_KEY_CHANNEL_ID;
+import static com.analysys.demo.ModifyConfigActivity.PREF_KEY_UPLOAD_URL;
+import static com.analysys.demo.ModifyConfigActivity.PREF_KEY_VISUAL_CONFIG_URL;
+import static com.analysys.demo.ModifyConfigActivity.PREF_KEY_VISUAL_DEBUG_URL;
+
+import java.util.HashMap;
+import java.util.Map;
+
/**
* @Copyright © 2019 EGuan Inc. All rights reserved.
* @Description: TODO
@@ -27,10 +39,15 @@ public class AnsApplication extends Application {
// public static final String UPLOAD_URL = "https://172.81.254.172:4089";
// private static final String SOCKET_URL = "wss://172.81.254.172:4091";
// private static final String CONFIG_URL = "https://172.81.254.172:4089";
- public static final String APP_KEY = "2709692586aa3e42";
- public static final String UPLOAD_URL = "https://arkpaastest.analysys.cn:4089";
- private static final String SOCKET_URL = "wss://arkpaastest.analysys.cn:4091";
- private static final String CONFIG_URL = "https://arkpaastest.analysys.cn:4089";
+// public static final String APP_KEY = "2709692586aa3e42";
+// public static final String UPLOAD_URL = "https://arkpaastest.analysys.cn:4089";
+// private static final String SOCKET_URL = "wss://arkpaastest.analysys.cn:4091";
+// private static final String CONFIG_URL = "https://arkpaastest.analysys.cn:4089";
+
+ public static final String APP_KEY = "3dc2312475ba8f98";
+ public static final String UPLOAD_URL = "https://uba-up.analysysdata.com";
+ private static final String SOCKET_URL = "wss://uba.analysysdata.com:4091";
+ private static final String CONFIG_URL = "https://uba-up.analysysdata.com";
private static AnsApplication instance;
private boolean isDebug = true;
@@ -44,34 +61,47 @@ public void onCreate() {
super.onCreate();
instance = this;
+ AnalysysAgent.track(this,"test_before");
// 设置严苛模式
- strictMode();
+ //strictMode();
// 初始化方舟SDK
- initAnalsysy();
+ initAnalysys();
+ //AnalysysAgent.alias();
// 尝试初始化对应模块
- if ("compatibility".equals(BuildConfig.Build_Type)) {
- AnsReflectUtils.invokeStaticMethod("com.analysys.compatibilitydemo.CompatibilityDemoInit", "init", Context.class, this);
- }
+// if ("compatibility".equals(BuildConfig.Build_Type)) {
+// AnsReflectUtils.invokeStaticMethod("com.analysys.compatibilitydemo.CompatibilityDemoInit", "init", Context.class, this);
+// }
+
+ TrackEventObserver.getInstance().init();
+ AnalysysAgent.registerSuperProperty(this,"testSuper","111111111");
+ AnalysysAgent.setCacheDataLength(getApplicationContext(),20);
+ AnalysysAgent.setUseGravity(getApplicationContext(),true);
+ AnalysysAgent.setListenDuration(getApplicationContext(),10);
+ AnalysysAgent.startListen(getApplicationContext());
}
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
+
}
/**
* 初始化方舟SDK相关API
*/
- private void initAnalsysy() {
+ private void initAnalysys() {
+ SharedPreferences sp = getSharedPreferences(PREF_FILE, Context.MODE_PRIVATE);
+
AnalysysAgent.setDebugMode(this, DEBUG_MODE);
// 设置 debug 模式,值:0、1、2
AnalysysConfig config = new AnalysysConfig();
- // 设置key(目前使用电商demo的key)
- config.setAppKey(APP_KEY);
+ // 设置key
+ config.setAppKey(sp.getString(PREF_KEY_APP_KEY, APP_KEY));
+ //config.setAppKey("3dc2312475ba8f98");
// 设置渠道
- config.setChannel("AnalsysyDemo");
+ config.setChannel(sp.getString(PREF_KEY_CHANNEL_ID, "AnalysysDemo"));
// 设置追踪新用户的首次属性
config.setAutoProfile(true);
// 设置使用AES加密
@@ -86,23 +116,39 @@ private void initAnalsysy() {
config.setAutoHeatMap(true);
// pageView自动上报总开关(默认开启)
config.setAutoTrackPageView(true);
+ // pageClose自动上报开关(默认关闭)
+ config.setAutoPageViewDuration(true);
// fragment-pageView自动上报开关(默认关闭)
- config.setAutoTrackFragmentPageView(false);
+ config.setAutoTrackFragmentPageView(true);
// 点击自动上报开关(默认关闭)
config.setAutoTrackClick(false);
config.setAutoTrackCrash(true);
config.setAutoTrackDeviceId(true);
+ config.setNeedDeduplication(true);
+
// 初始化
AnalysysAgent.init(this, config);
- AnalysysAgent.setUploadNetworkType(AnalysysAgent.AnalysysNetworkType.AnalysysNetworkWIFI);
// 设置数据上传/更新地址
- AnalysysAgent.setUploadURL(this, UPLOAD_URL);
- // 设置 WebSocket 连接 Url
- AnalysysAgent.setVisitorDebugURL(this, SOCKET_URL);
- // 设置配置下发 Url
- AnalysysAgent.setVisitorConfigURL(this, CONFIG_URL);
+ //AnalysysAgent.setUploadURL(this,"https://uba-up.analysysdata.com");
+
+ //AnalysysAgent.setUploadURL(this,"https://uba-up.analysysdata.com");
+
+ AnalysysAgent.setUploadURL(this, sp.getString(PREF_KEY_UPLOAD_URL, UPLOAD_URL));
+// // 设置 WebSocket 连接 Url
+ AnalysysAgent.setVisitorDebugURL(this, sp.getString(PREF_KEY_VISUAL_DEBUG_URL, SOCKET_URL));
+// // 设置配置下发 Url
+ AnalysysAgent.setVisitorConfigURL(this, sp.getString(PREF_KEY_VISUAL_CONFIG_URL, CONFIG_URL));
+
+// AnalysysAgent.getSSManager(this);
+// Map propMap = new HashMap<>();
+// propMap.put("test00001","啦啦啦啦啦哦哦哦0001");
+// propMap.put("test00002","啦啦啦啦啦哦哦哦0002");
+// AnalysysAgent.registerPreEventUserProperties(this,propMap);
+// AnalysysAgent.unRegisterPreEventUserProperties(this,"test00001");a
+
+
}
/**
diff --git a/ans-demo/apidemo/src/main/java/com/analysys/demo/BaseActivity.java b/ans-demo/apidemo/src/main/java/com/analysys/demo/BaseActivity.java
new file mode 100644
index 0000000..210c15e
--- /dev/null
+++ b/ans-demo/apidemo/src/main/java/com/analysys/demo/BaseActivity.java
@@ -0,0 +1,103 @@
+package com.analysys.demo;
+
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.animation.AlphaAnimation;
+
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import com.analysys.apidemo.R;
+import com.analysys.process.AgentProcess;
+
+import org.json.JSONObject;
+
+/**
+ * @Copyright © 2020 Analysys Inc. All rights reserved.
+ * @Description:
+ * @Create: 2020/7/22 11:06 AM
+ * @author: huchangqing
+ */
+public class BaseActivity extends AppCompatActivity implements AgentProcess.IEventObserver {
+
+
+ public static final String EXTRA_ACTIVITY_TITLE = "title";
+ public static final String EXTRA_EVENT_NAME = "event_name";
+
+ private String mEventName;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ Intent intent = getIntent();
+ String title = null;
+ if (intent != null) {
+ title = intent.getStringExtra(EXTRA_ACTIVITY_TITLE);
+ mEventName = intent.getStringExtra(EXTRA_EVENT_NAME);
+ }
+// ActionBar actionBar = getSupportActionBar();
+// if (actionBar != null) {
+// if (TextUtils.isEmpty(title)) {
+// actionBar.setDisplayShowTitleEnabled(false);
+// } else {
+// actionBar.setTitle(title);
+// }
+// }
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ TrackEventObserver.getInstance().setObserver(mEventName, this);
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ TrackEventObserver.getInstance().setObserver(null, null);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.base_menu, menu);
+ return super.onCreateOptionsMenu(menu);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getItemId() == R.id.action_info) {
+ showMsgDialog();
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ private void showMsgDialog() {
+ InfoDialog dialog = new InfoDialog(mEventName);
+ dialog.show(getSupportFragmentManager(), "info");
+ }
+
+ @Override
+ public void onEvent(String eventName, JSONObject sendData) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ hint(findViewById(R.id.action_info));
+ }
+ });
+ }
+
+ public void hint(View view) {
+ if (view == null) {
+ return;
+ }
+ AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1);
+ alphaAnimation.setDuration(300);
+ alphaAnimation.setRepeatCount(3);
+ view.startAnimation(alphaAnimation);
+ }
+}
diff --git a/ans-demo/apidemo/src/main/java/com/analysys/demo/EventActivity.java b/ans-demo/apidemo/src/main/java/com/analysys/demo/EventActivity.java
deleted file mode 100644
index f388a2f..0000000
--- a/ans-demo/apidemo/src/main/java/com/analysys/demo/EventActivity.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package com.analysys.demo;
-
-import android.content.Context;
-import android.os.Bundle;
-import android.view.View;
-
-import androidx.appcompat.app.AppCompatActivity;
-
-import com.analysys.ANSAutoPageTracker;
-import com.analysys.AnalysysAgent;
-import com.analysys.apidemo.R;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @Copyright © 2019 EGuan Inc. All rights reserved.
- * @Description: TODO
- * @Version: 1.0
- * @Create: 2019-07-01 00:48
- * @Author: Wang-X-C
- */
-public class EventActivity extends AppCompatActivity implements ANSAutoPageTracker {
- Context mContext = null;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_event);
- mContext = this.getApplicationContext();
- }
-
- public void onClick(View view) {
- int id = view.getId();
- if (id == R.id.singleTrack) {//统计用户确认订单的事件
- AnalysysAgent.track(mContext, "confirmOrder");
- } else if (id == R.id.multipleTrack) {//用户购买某一商品需支付2000元,
- Map track = new HashMap<>();
- track.put("money", 2000);
- AnalysysAgent.track(mContext.getApplicationContext(), "payment", track);
- } else if (id == R.id.singlePage) {//服务正在开展某个活动,需要统计活动页面时
- AnalysysAgent.pageView(mContext, "活动页");
- } else if (id == R.id.multiplePage) {//购买一部iPhone手机,手机价格为8000元
- Map page = new HashMap<>();
- page.put("commodityName", "iPhone");
- page.put("commodityPrice", 8000);
- AnalysysAgent.pageView(mContext, "商品页", page);
- }
- }
-
- @Override
- public Map registerPageProperties() {
- return null;
- }
-
- @Override
- public String registerPageUrl() {
- return null;
- }
-}
\ No newline at end of file
diff --git a/ans-demo/apidemo/src/main/java/com/analysys/demo/FragmentEvent.java b/ans-demo/apidemo/src/main/java/com/analysys/demo/FragmentEvent.java
new file mode 100644
index 0000000..d6fb504
--- /dev/null
+++ b/ans-demo/apidemo/src/main/java/com/analysys/demo/FragmentEvent.java
@@ -0,0 +1,121 @@
+package com.analysys.demo;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.BaseAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+
+import androidx.fragment.app.Fragment;
+
+import com.analysys.apidemo.R;
+
+import java.util.List;
+
+/**
+ * @Copyright © 2020 Analysys Inc. All rights reserved.
+ * @Description:
+ * @Create: 2020/7/21 5:22 PM
+ * @author: huchangqing
+ */
+public class FragmentEvent extends Fragment {
+
+ private String mEventName;
+
+ public FragmentEvent(String eventName) {
+ mEventName = eventName;
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_event, null);
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ ListView listView = view.findViewById(R.id.list_view);
+ List list = TrackEventObserver.getInstance().getData(mEventName);
+ MyAdapter adapter = new MyAdapter(getContext(), list);
+ listView.setAdapter(adapter);
+ listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id) {
+ adapter.setSelectedPosition(position);
+ }
+ });
+ }
+
+ public final class ViewHolder {
+ public TextView name;
+ public TextView time;
+ public TextView detail;
+ }
+
+ public class MyAdapter extends BaseAdapter {
+
+ private LayoutInflater mInflater;
+ private List mListData;
+ private int mSelectedPosition;
+
+ public MyAdapter(Context context, List list) {
+ this.mInflater = LayoutInflater.from(context);
+ mListData = list;
+ }
+
+ @Override
+ public int getCount() {
+ return mListData.size();
+ }
+
+ @Override
+ public Object getItem(int arg0) {
+ return null;
+ }
+
+ @Override
+ public long getItemId(int arg0) {
+ return 0;
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ ViewHolder holder;
+ if (convertView == null) {
+ holder = new ViewHolder();
+ convertView = mInflater.inflate(R.layout.list_row_event, null);
+ holder.name = convertView.findViewById(R.id.tv_name);
+ holder.time = convertView.findViewById(R.id.tv_time);
+ holder.detail = convertView.findViewById(R.id.tv_detail);
+ convertView.setTag(holder);
+ } else {
+ holder = (ViewHolder) convertView.getTag();
+ }
+ TrackEventObserver.EventData data = mListData.get(position);
+ holder.name.setText(data.eventName);
+ holder.time.setText(data.time);
+ if (position == mSelectedPosition) {
+ holder.detail.setText(data.getDetail());
+ holder.detail.setVisibility(View.VISIBLE);
+ } else {
+ holder.detail.setText("");
+ holder.detail.setVisibility(View.GONE);
+ }
+
+ return convertView;
+ }
+
+ public void setSelectedPosition(int position) {
+ if (mSelectedPosition == position) {
+ mSelectedPosition = -1;
+ } else {
+ mSelectedPosition = position;
+ }
+ notifyDataSetChanged();
+ }
+ }
+}
diff --git a/ans-demo/apidemo/src/main/java/com/analysys/demo/FragmentFull.java b/ans-demo/apidemo/src/main/java/com/analysys/demo/FragmentFull.java
new file mode 100644
index 0000000..87ba4ae
--- /dev/null
+++ b/ans-demo/apidemo/src/main/java/com/analysys/demo/FragmentFull.java
@@ -0,0 +1,86 @@
+package com.analysys.demo;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+
+import androidx.fragment.app.Fragment;
+
+import com.analysys.apidemo.R;
+import com.analysys.utils.Constants;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Copyright © 2020 Analysys Inc. All rights reserved.
+ * @Description:
+ * @Create: 2020/7/21 5:22 PM
+ * @author: huchangqing
+ */
+public class FragmentFull extends Fragment {
+
+ class ClickAction {
+ Class activityClz;
+ String itemName;
+ String eventName;
+
+ ClickAction(Class clz, String name, String eName) {
+ activityClz = clz;
+ itemName = name;
+ eventName = eName;
+ }
+
+ void doAction() {
+ Activity activity = getActivity();
+ if (activity == null) {
+ return;
+ }
+ Intent intent = new Intent(activity, activityClz);
+ intent.putExtra(BaseActivity.EXTRA_ACTIVITY_TITLE, itemName);
+ intent.putExtra(BaseActivity.EXTRA_EVENT_NAME, eventName);
+ activity.startActivity(intent);
+ }
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_full, null);
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ ListView listView = view.findViewById(R.id.list_view);
+ List list = new ArrayList<>();
+ list.add(new ClickAction(PropertyActivity.class, "通用属性", null));
+ list.add(new ClickAction(PageViewActivity.class, "页面采集", Constants.PAGE_VIEW));
+ list.add(new ClickAction(ProbeActivity.class, "全埋点", Constants.USER_CLICK));
+ list.add(new ClickAction(HeatMapActivity.class, "热图", Constants.APP_CLICK));
+ list.add(new ClickAction(VisualActivity.class, "可视化", null));
+ list.add(new ClickAction(TrackActivity.class, "统计事件", null));
+ list.add(new ClickAction(UserInfoActivity.class, "用户ID 用户属性", null));
+ list.add(new ClickAction(HybridActivity.class, "Hybrid", null));
+ list.add(new ClickAction(OtherActivity.class, "其它", null));
+ List listStr = new ArrayList<>();
+ for (int i = 0; i < list.size(); i++) {
+ listStr.add(list.get(i).itemName);
+ }
+ listView.setAdapter(new ArrayAdapter<>(getActivity(),
+ android.R.layout.simple_list_item_1,
+ android.R.id.text1,
+ listStr));
+ listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id) {
+ list.get(position).doAction();
+ }
+ });
+ }
+}
diff --git a/ans-demo/apidemo/src/main/java/com/analysys/demo/FragmentMini.java b/ans-demo/apidemo/src/main/java/com/analysys/demo/FragmentMini.java
new file mode 100644
index 0000000..07b530e
--- /dev/null
+++ b/ans-demo/apidemo/src/main/java/com/analysys/demo/FragmentMini.java
@@ -0,0 +1,89 @@
+package com.analysys.demo;
+
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.Toast;
+
+import androidx.fragment.app.Fragment;
+
+import com.analysys.ANSAutoPageTracker;
+import com.analysys.AnalysysAgent;
+import com.analysys.apidemo.R;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @Copyright © 2020 Analysys Inc. All rights reserved.
+ * @Description:
+ * @Create: 2020/7/21 5:22 PM
+ * @author: huchangqing
+ */
+public class FragmentMini extends Fragment implements View.OnClickListener {
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_mini, null);
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ Button btnNormal = view.findViewById(R.id.btn_track_normal);
+ btnNormal.setOnClickListener(this);
+ Button btnTrackName = view.findViewById(R.id.btn_track_name);
+ btnTrackName.setOnClickListener(this);
+ Button btnTrackProperty = view.findViewById(R.id.btn_track_property);
+ btnTrackProperty.setOnClickListener(this);
+
+ edtName = view.findViewById(R.id.edt_event_name);
+ edtKey = view.findViewById(R.id.edt_key);
+ edtValue = view.findViewById(R.id.edt_value);
+ }
+
+ private EditText edtName;
+ private EditText edtKey;
+ private EditText edtValue;
+
+ @Override
+ public void onClick(View view) {
+ String eventName = null;
+ if (view.getId() == R.id.btn_track_normal) {
+ eventName = "track_test";
+ AnalysysAgent.track(getContext(), eventName);
+ } else if (view.getId() == R.id.btn_track_name) {
+ eventName = edtName.getText().toString();
+ if (TextUtils.isEmpty(eventName)) {
+ Toast.makeText(getContext(), "名称不能为空", Toast.LENGTH_SHORT).show();
+ return;
+ }
+ AnalysysAgent.track(getContext(), eventName);
+ } else if (view.getId() == R.id.btn_track_property) {
+ String key = edtKey.getText().toString();
+ if (TextUtils.isEmpty(key)) {
+ Toast.makeText(getContext(), "Key不能为空", Toast.LENGTH_SHORT).show();
+ return;
+ }
+ String value = edtValue.getText().toString();
+ if (TextUtils.isEmpty(value)) {
+ Toast.makeText(getContext(), "Value不能为空", Toast.LENGTH_SHORT).show();
+ return;
+ }
+ Map data = new HashMap<>();
+ data.put(key, value);
+ eventName = "track_property";
+ AnalysysAgent.track(getContext(), eventName, data);
+ Toast.makeText(getContext(), "触发事件: " + eventName + "[" + key + "=" + value + "]", Toast.LENGTH_LONG).show();
+ }
+
+ Toast.makeText(getContext(), "触发事件: " + eventName, Toast.LENGTH_LONG).show();
+ }
+
+
+
+}
diff --git a/ans-demo/apidemo/src/main/java/com/analysys/demo/FragmentProbeOne.java b/ans-demo/apidemo/src/main/java/com/analysys/demo/FragmentProbeOne.java
new file mode 100644
index 0000000..6dada7b
--- /dev/null
+++ b/ans-demo/apidemo/src/main/java/com/analysys/demo/FragmentProbeOne.java
@@ -0,0 +1,48 @@
+package com.analysys.demo;
+
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.TextView;
+
+import androidx.fragment.app.Fragment;
+
+import com.analysys.AnalysysAgent;
+import com.analysys.apidemo.R;
+import com.analysys.process.AgentProcess;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class FragmentProbeOne extends Fragment {
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_probe_one, null);
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ String pageName = this.getClass().getName();
+ TextView tv = view.findViewById(R.id.tv_page_name);
+ tv.setText("页面名字:" + pageName);
+ CheckBox checkBox = view.findViewById(R.id.cb_ignore_page);
+ checkBox.setChecked(AgentProcess.getInstance().isThisPageInPageViewBlackList(pageName));
+ checkBox.setText(checkBox.getText() + pageName);
+ checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ if (isChecked) {
+ List list = new ArrayList<>();
+ list.add(pageName);
+ AnalysysAgent.setPageViewBlackListByPages(list);
+ } else {
+ AnalysysAgent.setPageViewBlackListByPages(null);
+ }
+ }
+ });
+ }
+}
diff --git a/ans-demo/apidemo/src/main/java/com/analysys/demo/FragmentProbeTwo.java b/ans-demo/apidemo/src/main/java/com/analysys/demo/FragmentProbeTwo.java
new file mode 100644
index 0000000..561eca2
--- /dev/null
+++ b/ans-demo/apidemo/src/main/java/com/analysys/demo/FragmentProbeTwo.java
@@ -0,0 +1,28 @@
+package com.analysys.demo;
+
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.fragment.app.Fragment;
+
+import com.analysys.allgro.annotations.AnalysysIgnorePage;
+import com.analysys.apidemo.R;
+
+@AnalysysIgnorePage
+public class FragmentProbeTwo extends Fragment {
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_probe_two, null);
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ String pageName = this.getClass().getName();
+ TextView tv = view.findViewById(R.id.tv_page_name);
+ tv.setText("页面名字:" + pageName);
+ }
+}
diff --git a/ans-demo/apidemo/src/main/java/com/analysys/demo/HeatMapActivity.java b/ans-demo/apidemo/src/main/java/com/analysys/demo/HeatMapActivity.java
new file mode 100644
index 0000000..3fb0edc
--- /dev/null
+++ b/ans-demo/apidemo/src/main/java/com/analysys/demo/HeatMapActivity.java
@@ -0,0 +1,67 @@
+package com.analysys.demo;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.Switch;
+
+import com.analysys.AnalysysAgent;
+import com.analysys.apidemo.R;
+import com.analysys.process.AgentProcess;
+import com.analysys.utils.Constants;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class HeatMapActivity extends BaseActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_heatmap);
+ Switch autoTrack = findViewById(R.id.auto_track);
+ autoTrack.setChecked(AgentProcess.getInstance().getConfig().isAutoHeatMap());
+ autoTrack.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ AgentProcess.getInstance().getConfig().setAutoHeatMap(isChecked);
+ }
+ });
+
+ String testPageName = HeatMapTestActivity.class.getName();
+
+ Button btnOpenPage = findViewById(R.id.btn_open_page);
+ btnOpenPage.setText(btnOpenPage.getText() + testPageName);
+
+ CheckBox cbIgnorePage = findViewById(R.id.cb_ignore_page);
+ cbIgnorePage.setText(cbIgnorePage.getText() + testPageName);
+ cbIgnorePage.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ if (isChecked) {
+ List list = new ArrayList<>();
+ list.add(testPageName);
+ AnalysysAgent.setHeatMapBlackListByPages(list);
+ } else {
+ AnalysysAgent.setHeatMapBlackListByPages(null);
+ }
+ }
+ });
+ }
+
+ public void onClick(View view) {
+ int id = view.getId();
+ if (id == R.id.btn_open_page) {
+ Intent intent = new Intent(this, HeatMapTestActivity.class);
+ intent.putExtra(BaseActivity.EXTRA_ACTIVITY_TITLE, "热图页面测试");
+ intent.putExtra(BaseActivity.EXTRA_EVENT_NAME, Constants.APP_CLICK);
+ startActivity(intent);
+ }
+ if (id == R.id.btn_open_fragment_page) {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/ans-demo/apidemo/src/main/java/com/analysys/demo/HeatMapTestActivity.java b/ans-demo/apidemo/src/main/java/com/analysys/demo/HeatMapTestActivity.java
index aa01179..6332e6e 100644
--- a/ans-demo/apidemo/src/main/java/com/analysys/demo/HeatMapTestActivity.java
+++ b/ans-demo/apidemo/src/main/java/com/analysys/demo/HeatMapTestActivity.java
@@ -1,47 +1,17 @@
package com.analysys.demo;
-import android.content.Intent;
import android.os.Bundle;
-import android.view.View;
+import android.widget.TextView;
-import com.analysys.AnalysysAgent;
import com.analysys.apidemo.R;
-import java.util.ArrayList;
-import java.util.List;
-
-import androidx.appcompat.app.AppCompatActivity;
-
-/**
- * Description: 热图黑白名单测试
- * Author: fengzeyuan
- * Date: 2019-11-20 16:34
- * Version: 1.0
- */
-public class HeatMapTestActivity extends AppCompatActivity {
-
- private List mPages;
+public class HeatMapTestActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_heatmap_test);
- mPages = new ArrayList<>();
- mPages.add(MainActivity.class.getName());
- mPages.add(UserSettingActivity.class.getName());
- }
-
- public void onClick(View view) {
- int id = view.getId();
- if (id == R.id.ignoreButton) {
- // 设置热图黑名单
- AnalysysAgent.setHeatMapBlackListByPages(mPages);
- } else if (id == R.id.clearButton) {
- List pages = new ArrayList<>();
- AnalysysAgent.setHeatMapBlackListByPages(pages);
- AnalysysAgent.setHeatMapWhiteListByPages(pages);
- } else if (id == R.id.SingleProcessButton) {
- startActivity(new Intent(HeatMapTestActivity.this, SingleProcessTestActivity.class));
- }
+ TextView tv = findViewById(R.id.tv_page_name);
+ tv.setText("页面名字:" + getClass().getName());
}
}
diff --git a/ans-demo/apidemo/src/main/java/com/analysys/demo/WebViewActivity.java b/ans-demo/apidemo/src/main/java/com/analysys/demo/HybridActivity.java
similarity index 52%
rename from ans-demo/apidemo/src/main/java/com/analysys/demo/WebViewActivity.java
rename to ans-demo/apidemo/src/main/java/com/analysys/demo/HybridActivity.java
index e0ce42b..c907725 100644
--- a/ans-demo/apidemo/src/main/java/com/analysys/demo/WebViewActivity.java
+++ b/ans-demo/apidemo/src/main/java/com/analysys/demo/HybridActivity.java
@@ -1,40 +1,44 @@
package com.analysys.demo;
import android.annotation.SuppressLint;
+import android.app.ProgressDialog;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.ViewGroup;
import android.view.ViewParent;
+import android.webkit.WebChromeClient;
+import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
-import android.widget.LinearLayout;
-import androidx.appcompat.app.AppCompatActivity;
-
-import com.analysys.ANSAutoPageTracker;
import com.analysys.AnalysysAgent;
import com.analysys.apidemo.R;
-import java.util.Map;
-
-/**
- * @Copyright © 2019 EGuan Inc. All rights reserved.
- * @Description: TODO
- * @Version: 1.0
- * @Create: 2019-07-01 00:48
- * @Author: Wang-X-C
- */
-public class WebViewActivity extends AppCompatActivity implements ANSAutoPageTracker {
+public class HybridActivity extends BaseActivity {
private WebView mWebView;
private Context mContext = null;
+ private ProgressDialog dialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_web_view);
- initWebView();
+ setContentView(getContentLayoutId());
mContext = this.getApplicationContext();
+ initWebView();
+
+ dialog = new ProgressDialog(this);
+ dialog.setTitle("提示");
+ dialog.setMessage("WebView加载中...");
+ dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
+ dialog.setCancelable(true);
+ dialog.setIndeterminate(true);
+ dialog.setMax(100);
+ dialog.show();
+ }
+
+ protected int getContentLayoutId() {
+ return R.layout.activity_hybrid;
}
@Override
@@ -47,57 +51,50 @@ protected void onDestroy() {
((ViewGroup) parent).removeView(mWebView);
}
mWebView.stopLoading();
+
+ mWebView.clearCache(true);
+
// 退出时调用此方法,移除绑定的服务,否则某些特定系统会报错
mWebView.getSettings().setJavaScriptEnabled(false);
mWebView.clearHistory();
mWebView.clearView();
mWebView.removeAllViews();
mWebView.destroy();
-
+// AnalysysAgent.resetHybridModel(mContext, mWebView);
+ AnalysysAgent.resetAnalysysAgentHybrid(mWebView);
+ mWebView = null;
}
super.onDestroy();
- AnalysysAgent.resetHybridModel(mContext, mWebView);
}
@SuppressLint("SetJavaScriptEnabled")
private void initWebView() {
- mWebView = new WebView(getApplicationContext());
- LinearLayout linearLayout = findViewById(R.id.webViewLayout);
- linearLayout.addView(mWebView);
- mWebView.loadUrl("http://uc.analysys.cn/huaxiang/hybrid-4.3.0.10/");
+ mWebView = findViewById(R.id.web_view);
+ mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
+ mWebView.clearCache(true);
+ mWebView.clearHistory();
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
-// mWebView.setWebViewClient(new OldWebviewClient());
- // 设置UserAgent
- AnalysysAgent.setHybridModel(mContext, mWebView);
- // 设置WebViewClient
- mWebView.setWebViewClient(new MyWebviewClient());
- }
-
- @Override
- public Map registerPageProperties() {
- return null;
- }
-
- @Override
- public String registerPageUrl() {
- return "WebView 页";
- }
-
- class OldWebviewClient extends WebViewClient {
- @Override
- public void onPageFinished(WebView view, String url) {
- }
-
- @Override
- public boolean shouldOverrideUrlLoading(WebView view, String url) {
- Log.d("analysys.hybrid", "old: shouldOverrideUrlLoading url:" + url);
-// AnalysysAgent.interceptUrl(mContext, url, view);
- return false;
- }
+ //mWebView.loadUrl("http://192.168.31.48:5173");
+ mWebView.loadUrl("http://192.168.50.3:8080");
+ //mWebView.loadUrl("http://10.9.24.114:9292?v=" + System.currentTimeMillis());
+// mWebView.setWebViewClient(new MyWebviewClient());
+ mWebView.setWebChromeClient(new WebChromeClient() {
+ @Override
+ public void onProgressChanged(WebView view, int newProgress) {
+ super.onProgressChanged(view, newProgress);
+ dialog.setProgress(newProgress);
+ if (newProgress == 100) {
+ dialog.dismiss();
+ }
+ }
+ });
+// AnalysysAgent.setHybridModel(mContext, mWebView);
+ AnalysysAgent.setAnalysysAgentHybrid(mWebView);
}
class MyWebviewClient extends WebViewClient {
+
@Override
public void onPageFinished(WebView view, String url) {
Log.d("analysys.hybrid", "onPageFinished url:" + url);
@@ -105,8 +102,7 @@ public void onPageFinished(WebView view, String url) {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
- Log.d("analysys.hybrid", "new: shouldOverrideUrlLoading url:" + url);
- // 设置URL拦截
+ Log.d("analysys.hybrid", "shouldOverrideUrlLoading url:" + url);
AnalysysAgent.interceptUrl(mContext, url, view);
return false;
}
diff --git a/ans-demo/apidemo/src/main/java/com/analysys/demo/InfoDialog.java b/ans-demo/apidemo/src/main/java/com/analysys/demo/InfoDialog.java
new file mode 100644
index 0000000..5984530
--- /dev/null
+++ b/ans-demo/apidemo/src/main/java/com/analysys/demo/InfoDialog.java
@@ -0,0 +1,101 @@
+package com.analysys.demo;
+
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.fragment.app.DialogFragment;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentPagerAdapter;
+import androidx.viewpager.widget.ViewPager;
+
+import com.analysys.apidemo.R;
+
+public class InfoDialog extends DialogFragment implements ViewPager.OnPageChangeListener, View.OnClickListener {
+
+ private FragmentPagerAdapter adapter;
+
+ private ViewPager mViewPager;
+ private TextView mTVEvent;
+ // private TextView mTVUser;
+// private TextView mTVProperty;
+ private String mEventName;
+
+ public InfoDialog(String eventName) {
+ mEventName = eventName;
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ adapter = new FragmentPagerAdapter(getChildFragmentManager()) {
+ @Override
+ public Fragment getItem(int position) {
+ switch (position) {
+ case 0:
+ return new FragmentEvent(mEventName);
+// case 1:
+// return new FragmentUser();
+// case 2:
+// return new FragmentProperty();
+ default:
+ return null;
+ }
+ }
+
+ @Override
+ public int getCount() {
+ return 1;
+ }
+ };
+
+ return inflater.inflate(R.layout.dialog_info, null);
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ mTVEvent = view.findViewById(R.id.tv_event);
+ mTVEvent.setOnClickListener(this);
+// mTVUser = view.findViewById(R.id.tv_user);
+// mTVUser.setOnClickListener(this);
+// mTVProperty = view.findViewById(R.id.tv_property);
+// mTVProperty.setOnClickListener(this);
+ mViewPager = view.findViewById(R.id.view_pager);
+ mViewPager.setAdapter(adapter);
+ mViewPager.addOnPageChangeListener(this);
+ mTVEvent.setSelected(true);
+// mTVUser.setSelected(false);
+// mTVProperty.setSelected(false);
+ }
+
+ @Override
+ public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
+
+ }
+
+ @Override
+ public void onPageSelected(int position) {
+ mTVEvent.setSelected(position == 0);
+// mTVUser.setSelected(position == 1);
+// mTVProperty.setSelected(position == 2);
+ }
+
+ @Override
+ public void onPageScrollStateChanged(int state) {
+
+ }
+
+ @Override
+ public void onClick(View view) {
+ int id = view.getId();
+ if (id == R.id.tv_event) {
+ mViewPager.setCurrentItem(0, true);
+ }
+// else if (id == R.id.tv_user) {
+// mViewPager.setCurrentItem(1, true);
+// } else if (id == R.id.tv_property) {
+// mViewPager.setCurrentItem(2, true);
+// }
+ }
+}
\ No newline at end of file
diff --git a/ans-demo/apidemo/src/main/java/com/analysys/demo/MainActivity.java b/ans-demo/apidemo/src/main/java/com/analysys/demo/MainActivity.java
index e9af679..a53d21d 100644
--- a/ans-demo/apidemo/src/main/java/com/analysys/demo/MainActivity.java
+++ b/ans-demo/apidemo/src/main/java/com/analysys/demo/MainActivity.java
@@ -1,81 +1,127 @@
package com.analysys.demo;
+
+
import android.content.Intent;
import android.os.Bundle;
+import android.text.SpannableString;
+import android.text.style.ForegroundColorSpan;
+import android.view.Menu;
+import android.view.MenuItem;
import android.view.View;
+import android.widget.TextView;
+
+import androidx.appcompat.app.ActionBar;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentPagerAdapter;
+import androidx.viewpager.widget.ViewPager;
-import androidx.appcompat.app.AppCompatActivity;
import com.analysys.ANSAutoPageTracker;
import com.analysys.AnalysysAgent;
import com.analysys.apidemo.R;
-import com.analysys.demo.allgroTest.AllgroTestActivity;
import java.util.HashMap;
import java.util.Map;
/**
- * @Copyright © 2019 EGuan Inc. All rights reserved.
- * @Description: TODO
- * @Version: 1.0
- * @Create: 2019-07-01 00:48
- * @Author: Wang-X-C
+ * @Copyright © 2020 Analysys Inc. All rights reserved.
+ * @Description:
+ * @Create: 2020/7/20 7:00 PM
+ * @author: huchangqing
*/
-public class MainActivity extends AppCompatActivity implements ANSAutoPageTracker {
+public class MainActivity extends BaseActivity implements ViewPager.OnPageChangeListener {
+
+ private FragmentMini mFragmentMini = new FragmentMini();
+ private FragmentFull mFragmentFull = new FragmentFull();
+
+
+ private FragmentPagerAdapter adapter = new FragmentPagerAdapter(getSupportFragmentManager()) {
+ @Override
+ public Fragment getItem(int position) {
+ switch (position) {
+ case 0:
+ return mFragmentMini;
+ case 1:
+ return mFragmentFull;
+ default:
+ return null;
+ }
+ }
+
+ @Override
+ public int getCount() {
+ return 2;
+ }
+ };
+
+ private ViewPager mViewPager;
+ private TextView mTVMini;
+ private TextView mTVFull;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
- Intent intent = getIntent();
- if (intent != null && intent.getData() != null) {
- // 判断如果是deepLink启动,设置启动来源为 3
- AnalysysAgent.launchSource(3);
- }
+ mViewPager = findViewById(R.id.view_pager);
+ mTVMini = findViewById(R.id.tv_mini);
+ mTVFull = findViewById(R.id.tv_full);
+ mViewPager.setAdapter(adapter);
+ mViewPager.addOnPageChangeListener(this);
+ mTVMini.setSelected(true);
+ mTVFull.setSelected(false);
+// ActionBar actionBar = getSupportActionBar();
+// if (actionBar != null) {
+// actionBar.setDisplayShowTitleEnabled(true);
+// actionBar.setTitle("易观方舟Demo");
+// }
+// AnalysysAgent.track(this,"homepage");
+ }
+
+ @Override
+ public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
+
}
- public void onClick(View view) {
- int id = view.getId();
- if (id == R.id.profileButton) {
- startActivity(new Intent(MainActivity.this, ProfileActivity.class));
- } else if (id == R.id.propertyButton) {
- startActivity(new Intent(MainActivity.this, PropertyActivity.class));
- } else if (id == R.id.eventButton) {
- startActivity(new Intent(MainActivity.this, EventActivity.class));
- } else if (id == R.id.userButton) {
- startActivity(new Intent(MainActivity.this, UserSettingActivity.class));
- } else if (id == R.id.webViewButton) {
- startActivity(new Intent(MainActivity.this, WebViewActivity.class));
- } else if (id == R.id.visualDemoButton) {
- // 跳转可视化模块
- try {
- Class clz = Class.forName("com.analysys.visualdemo.activity.TopVisualMainActivity");
- startActivity(new Intent(this, clz));
- } catch (ClassNotFoundException e) {
- }
- } else if (id == R.id.TestHeatMapButton) {
- // 热图黑名单测试
- startActivity(new Intent(MainActivity.this, HeatMapTestActivity.class));
- } else if (id == R.id.TestAllgroButton) {
- // 跳转全埋点模块
- startActivity(new Intent(MainActivity.this, AllgroTestActivity.class));
- }
+ @Override
+ public void onPageSelected(int position) {
+ mTVMini.setSelected(position == 0);
+ mTVFull.setSelected(position == 1);
+ }
+
+ @Override
+ public void onPageScrollStateChanged(int state) {
+
}
@Override
- public Map registerPageProperties() {
- // $title为自动采集使用key,用户可覆盖
- Map properties = new HashMap<>();
- properties.put("$title", "详情页");
- return properties;
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.main_menu, menu);
+ MenuItem item = menu.findItem(R.id.action_modify);
+ SpannableString spannableString = new SpannableString(item.getTitle());
+ spannableString.setSpan(new ForegroundColorSpan(0xff2222ee), 0, spannableString.length(), 0);
+ item.setTitle(spannableString);
+ return true;
}
@Override
- public String registerPageUrl() {
- // 页面$url字段,将覆盖SDK默认字段
- return "HomePage";
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getItemId() == R.id.action_modify) {
+ Intent intent = new Intent(this, ModifyConfigActivity.class);
+ intent.putExtra(BaseActivity.EXTRA_ACTIVITY_TITLE, "修改配置");
+ startActivity(intent);
+ }
+ return super.onOptionsItemSelected(item);
}
+ public void onTabClick(View view) {
+ int id = view.getId();
+ if (id == R.id.tv_mini) {
+ mViewPager.setCurrentItem(0, true);
+ } else if (id == R.id.tv_full) {
+ mViewPager.setCurrentItem(1, true);
+ }
+ }
}
diff --git a/ans-demo/apidemo/src/main/java/com/analysys/demo/MainActivityTest.java b/ans-demo/apidemo/src/main/java/com/analysys/demo/MainActivityTest.java
new file mode 100644
index 0000000..ae59af4
--- /dev/null
+++ b/ans-demo/apidemo/src/main/java/com/analysys/demo/MainActivityTest.java
@@ -0,0 +1,4 @@
+package com.analysys.demo;
+
+public class MainActivityTest extends BaseActivity{
+}
diff --git a/ans-demo/apidemo/src/main/java/com/analysys/demo/ModifyConfigActivity.java b/ans-demo/apidemo/src/main/java/com/analysys/demo/ModifyConfigActivity.java
new file mode 100644
index 0000000..15bb2d7
--- /dev/null
+++ b/ans-demo/apidemo/src/main/java/com/analysys/demo/ModifyConfigActivity.java
@@ -0,0 +1,115 @@
+package com.analysys.demo;
+
+import android.annotation.SuppressLint;
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.EditText;
+
+import com.analysys.apidemo.R;
+import com.analysys.process.AgentProcess;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Copyright © 2020 Analysys Inc. All rights reserved.
+ * @Description:
+ * @Create: 2020/7/22 11:04 AM
+ * @author: huchangqing
+ */
+public class ModifyConfigActivity extends BaseActivity {
+
+ private EditText edtAppKey;
+ private EditText edtChannelId;
+ private EditText edtUploadUrl;
+ private EditText edtVisualDebugUrl;
+ private EditText edtVisualConfigUrl;
+ private SharedPreferences sp;
+
+ public static final String PREF_FILE = "ans_demo_pref";
+ public static final String PREF_KEY_APP_KEY = "app_key";
+ public static final String PREF_KEY_CHANNEL_ID = "channel_id";
+ public static final String PREF_KEY_UPLOAD_URL = "upload_url";
+ public static final String PREF_KEY_VISUAL_DEBUG_URL = "visual_debug_url";
+ public static final String PREF_KEY_VISUAL_CONFIG_URL = "visual_config_url";
+
+ class ConfigAction {
+ EditText view;
+ String prefKey;
+
+ ConfigAction(EditText v, String key, String defaultValue) {
+ view = v;
+ prefKey = key;
+ String config = sp.getString(prefKey, defaultValue);
+ view.setText(config);
+ }
+
+ @SuppressLint("ApplySharedPref")
+ void saveConfig() {
+ sp.edit().putString(prefKey, view.getText().toString()).commit();
+ }
+
+ public void clear() {
+ sp.edit().remove(prefKey).commit();
+ }
+ }
+
+ private List mConfigList = new ArrayList<>();
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_modify_config);
+ sp = getSharedPreferences(PREF_FILE, Context.MODE_PRIVATE);
+
+ edtAppKey = findViewById(R.id.edt_app_key);
+ ConfigAction configAction = new ConfigAction(edtAppKey, PREF_KEY_APP_KEY, AgentProcess.getInstance().getConfig().getAppKey());
+ mConfigList.add(configAction);
+
+ edtChannelId = findViewById(R.id.edt_channel_id);
+ configAction = new ConfigAction(edtChannelId, PREF_KEY_CHANNEL_ID, AgentProcess.getInstance().getConfig().getChannel());
+ mConfigList.add(configAction);
+
+ edtUploadUrl = findViewById(R.id.edt_upload_url);
+ configAction = new ConfigAction(edtUploadUrl, PREF_KEY_UPLOAD_URL, AgentProcess.getInstance().getUploadURL());
+ mConfigList.add(configAction);
+
+ edtVisualDebugUrl = findViewById(R.id.edt_visual_debug_url);
+ configAction = new ConfigAction(edtVisualDebugUrl, PREF_KEY_VISUAL_DEBUG_URL, AgentProcess.getInstance().getVisitorDebugURL());
+ mConfigList.add(configAction);
+
+ edtVisualConfigUrl = findViewById(R.id.edt_visual_config_url);
+ configAction = new ConfigAction(edtVisualConfigUrl, PREF_KEY_VISUAL_CONFIG_URL, AgentProcess.getInstance().getVisitorConfigURL());
+ mConfigList.add(configAction);
+ }
+
+ public void onClick(View view) {
+ boolean isSave = view.getId() == R.id.btn_save;
+ for (ConfigAction config : mConfigList) {
+ if (isSave) {
+ config.saveConfig();
+ } else {
+ config.clear();
+ }
+ }
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ StringBuilder sb = new StringBuilder();
+ sb.append("AppKey: ").append(edtAppKey.getText().toString()).append("\n");
+ sb.append("Channel ID: ").append(edtChannelId.getText().toString()).append("\n");
+ sb.append("Upload Url: ").append(edtUploadUrl.getText().toString()).append("\n");
+ sb.append("Visual Debug Url: ").append(edtVisualDebugUrl.getText().toString()).append("\n");
+ sb.append("Visual Config Url: ").append(edtVisualConfigUrl.getText().toString()).append("\n");
+ builder.setMessage(sb.toString());
+ builder.setTitle("修改配置后需要重启才能生效");
+ builder.setPositiveButton("确认", new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ System.exit(0);
+ }
+ }).setCancelable(false).create().show();
+ }
+}
diff --git a/ans-demo/apidemo/src/main/java/com/analysys/demo/OtherActivity.java b/ans-demo/apidemo/src/main/java/com/analysys/demo/OtherActivity.java
new file mode 100644
index 0000000..27c61ac
--- /dev/null
+++ b/ans-demo/apidemo/src/main/java/com/analysys/demo/OtherActivity.java
@@ -0,0 +1,240 @@
+package com.analysys.demo;
+
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.CompoundButton;
+import android.widget.EditText;
+import android.widget.Spinner;
+import android.widget.Switch;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.analysys.AnalysysAgent;
+import com.analysys.AnsRamControl;
+import com.analysys.EncryptEnum;
+import com.analysys.apidemo.R;
+import com.analysys.process.AgentProcess;
+import com.analysys.strategy.PolicyManager;
+import com.analysys.utils.CommonUtils;
+import com.analysys.utils.Constants;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class OtherActivity extends BaseActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_other);
+ TextView tvVersion = findViewById(R.id.tv_version);
+ tvVersion.setText("App Version: " + CommonUtils.getVersionName(this) + "\nSDK Version: " + Constants.DEV_SDK_VERSION);
+
+ Switch enableDataCollect = findViewById(R.id.enable_data_collect);
+ enableDataCollect.setChecked(AgentProcess.getInstance().isDataCollectEnable());
+ enableDataCollect.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ AnalysysAgent.setDataCollectEnable(isChecked);
+ }
+ });
+
+ Spinner spinner = findViewById(R.id.sp_network);
+ List listStr = new ArrayList<>();
+ listStr.add("不允许上传");
+ listStr.add("允许移动网络上传");
+ listStr.add("允许wifi网络上传");
+ listStr.add("允许所有网络上传");
+ List listValues = new ArrayList<>();
+ listValues.add(AnalysysAgent.AnalysysNetworkType.AnalysysNetworkNONE);
+ listValues.add(AnalysysAgent.AnalysysNetworkType.AnalysysNetworkWWAN);
+ listValues.add(AnalysysAgent.AnalysysNetworkType.AnalysysNetworkWIFI);
+ listValues.add(AnalysysAgent.AnalysysNetworkType.AnalysysNetworkALL);
+ initSpinner(spinner, listStr, new IOnItemSelected() {
+ @Override
+ public void onSelected(int pos) {
+ AnalysysAgent.setUploadNetworkType(listValues.get(pos));
+ }
+ }, listValues.indexOf(AnsRamControl.getInstance().getUploadNetworkType()));
+
+ spinner = findViewById(R.id.sp_encrypt);
+ listStr = new ArrayList<>();
+ listStr.add("EMPTY");
+ listStr.add("AES_ECB");
+ listStr.add("AES_CBC");
+ List listValuesEncrypt = new ArrayList<>();
+ listValuesEncrypt.add(EncryptEnum.EMPTY);
+ listValuesEncrypt.add(EncryptEnum.AES);
+ listValuesEncrypt.add(EncryptEnum.AES_CBC);
+ initSpinner(spinner, listStr, new IOnItemSelected() {
+ @Override
+ public void onSelected(int pos) {
+ AgentProcess.getInstance().getConfig().setEncryptType((listValuesEncrypt.get(pos)));
+ }
+ }, listValuesEncrypt.indexOf(AgentProcess.getInstance().getConfig().getEncryptType()));
+
+ spinner = findViewById(R.id.sp_debug_mode);
+ listStr = new ArrayList<>();
+ listStr.add("关闭debug");
+ listStr.add("打开Debug,不计统计");
+ listStr.add("打开Debug,计入统计");
+ List listValuesDebugMode = new ArrayList<>();
+ listValuesDebugMode.add(0);
+ listValuesDebugMode.add(1);
+ listValuesDebugMode.add(2);
+ initSpinner(spinner, listStr, new IOnItemSelected() {
+ @Override
+ public void onSelected(int pos) {
+ AnalysysAgent.setDebugMode(OtherActivity.this, listValuesDebugMode.get(pos));
+ }
+ }, listValuesDebugMode.indexOf(CommonUtils.getDebugMode(this)));
+
+ EditText editText = findViewById(R.id.edt_interval);
+ editText.setText(PolicyManager.getIntervalTime(this) / 1000 + "");
+ editText = findViewById(R.id.edt_max_event);
+ editText.setText(PolicyManager.getEventCount(this) + "");
+ editText = findViewById(R.id.edt_max_cache);
+ editText.setText(AnalysysAgent.getMaxCacheSize(this) + "");
+
+ Switch autoTimeCheck = findViewById(R.id.time_check);
+ autoTimeCheck.setChecked(AgentProcess.getInstance().getConfig().isTimeCheck());
+ autoTimeCheck.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ AgentProcess.getInstance().getConfig().setAllowTimeCheck(isChecked);
+ }
+ });
+
+ editText = findViewById(R.id.edt_time_check);
+ editText.setText(AgentProcess.getInstance().getConfig().getMaxDiffTimeInterval() / 1000 + "");
+
+ Switch autoDeviceInfo = findViewById(R.id.device_info);
+ autoDeviceInfo.setChecked(AgentProcess.getInstance().getConfig().isAutoTrackDeviceId());
+ autoDeviceInfo.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ AgentProcess.getInstance().getConfig().setAutoTrackDeviceId(isChecked);
+ }
+ });
+
+ Switch autoTrackCrash = findViewById(R.id.auto_track_crash);
+ autoTrackCrash.setChecked(AgentProcess.getInstance().getConfig().isAutoTrackCrash());
+ autoTrackCrash.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ AgentProcess.getInstance().getConfig().setAutoTrackCrash(isChecked);
+ }
+ });
+
+ Switch autoTrack = findViewById(R.id.auto_track_page_view);
+ autoTrack.setChecked(AgentProcess.getInstance().getConfig().isAutoTrackPageView());
+ autoTrack.setOnCheckedChangeListener((buttonView, isChecked)
+ -> AgentProcess.getInstance().getConfig().setAutoTrackPageView(isChecked));
+
+ autoTrack = findViewById(R.id.auto_track_probe_click);
+ autoTrack.setChecked(AgentProcess.getInstance().getConfig().isAutoTrackClick());
+ autoTrack.setOnCheckedChangeListener((buttonView, isChecked)
+ -> AgentProcess.getInstance().getConfig().setAutoTrackClick(isChecked));
+
+ autoTrack = findViewById(R.id.auto_track_heat_map);
+ autoTrack.setChecked(AgentProcess.getInstance().getConfig().isAutoHeatMap());
+ autoTrack.setOnCheckedChangeListener((buttonView, isChecked)
+ -> AgentProcess.getInstance().getConfig().setAutoHeatMap(isChecked));
+ }
+
+ private interface IOnItemSelected {
+ void onSelected(int pos);
+ }
+
+ private void initSpinner(Spinner spinner, List listStr, IOnItemSelected onItemSelectedCallabck, int initPos) {
+ spinner.setAdapter(new ArrayAdapter<>(this,
+ android.R.layout.simple_list_item_1,
+ android.R.id.text1,
+ listStr));
+ spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+ @Override
+ public void onItemSelected(AdapterView> parent, View view, int pos, long id) {
+ onItemSelectedCallabck.onSelected(pos);
+ Toast.makeText(OtherActivity.this, "设置成功", Toast.LENGTH_SHORT).show();
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView> parent) {
+ }
+ });
+ spinner.setSelection(initPos);
+ }
+
+ private long edt2Long(int resId, long min, long max) {
+ long value = -1;
+ try {
+ EditText editText = findViewById(resId);
+ value = Long.parseLong(editText.getText().toString());
+ } catch (Exception e) {
+ }
+ if (value > max || value < min) {
+ value = -1;
+ }
+ return value;
+ }
+
+ public void onClick(View view) {
+ int viewId = view.getId();
+ if (viewId == R.id.btn_interval) {
+ long value = edt2Long(R.id.edt_interval, 1, Long.MAX_VALUE);
+ if (value == -1) {
+ Toast.makeText(this, "输入错误", Toast.LENGTH_SHORT).show();
+ } else {
+ AnalysysAgent.setIntervalTime(this, value);
+ Toast.makeText(this, "操作成功", Toast.LENGTH_SHORT).show();
+ }
+ } else if (viewId == R.id.btn_max_event) {
+ long value = edt2Long(R.id.edt_max_event, 1, Long.MAX_VALUE);
+ if (value == -1) {
+ Toast.makeText(this, "输入错误", Toast.LENGTH_SHORT).show();
+ } else {
+ AnalysysAgent.setMaxEventSize(this, value);
+ Toast.makeText(this, "操作成功", Toast.LENGTH_SHORT).show();
+ }
+ } else if (viewId == R.id.btn_max_cache) {
+ long value = edt2Long(R.id.edt_max_cache, 1, Long.MAX_VALUE);
+ if (value == -1) {
+ Toast.makeText(this, "输入错误", Toast.LENGTH_SHORT).show();
+ } else {
+ AnalysysAgent.setMaxCacheSize(this, value);
+ Toast.makeText(this, "操作成功", Toast.LENGTH_SHORT).show();
+ }
+ } else if (viewId == R.id.btn_time_check) {
+ long value = edt2Long(R.id.edt_time_check, 1, Long.MAX_VALUE);
+ if (value == -1) {
+ Toast.makeText(this, "输入错误", Toast.LENGTH_SHORT).show();
+ } else {
+ AgentProcess.getInstance().getConfig().setMaxDiffTimeInterval(value);
+ Toast.makeText(this, "操作成功", Toast.LENGTH_SHORT).show();
+ }
+ } else if (viewId == R.id.btn_crash) {
+ Toast.makeText(this, "操作成功,在logcat中查看xwhat为$app_crash的日志", Toast.LENGTH_LONG).show();
+ int crash = 1 / 0;
+ } else if (viewId == R.id.btn_get_property) {
+ Map getProperty = AnalysysAgent.getPresetProperties(this);
+ StringBuilder properties = new StringBuilder();
+ if (getProperty != null) {
+ for (Map.Entry entry : getProperty.entrySet()) {
+ properties.append("\n").append(entry.getKey()).append(" = " + entry.getValue());
+ }
+ }
+ String props = properties.toString();
+ Toast.makeText(this, "所有预置属性值为" + (TextUtils.isEmpty(props) ? "空" : props), Toast.LENGTH_LONG).show();
+ } else if (viewId == R.id.btn_clean_db) {
+ AnalysysAgent.cleanDBCache();
+ Toast.makeText(this, "操作成功", Toast.LENGTH_SHORT).show();
+ } else if (viewId == R.id.btn_reset) {
+ AnalysysAgent.reset(this);
+ Toast.makeText(this, "操作成功", Toast.LENGTH_SHORT).show();
+ }
+ }
+}
diff --git a/ans-demo/apidemo/src/main/java/com/analysys/demo/PageViewActivity.java b/ans-demo/apidemo/src/main/java/com/analysys/demo/PageViewActivity.java
new file mode 100644
index 0000000..ca203f8
--- /dev/null
+++ b/ans-demo/apidemo/src/main/java/com/analysys/demo/PageViewActivity.java
@@ -0,0 +1,85 @@
+package com.analysys.demo;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.Switch;
+import android.widget.Toast;
+
+import com.analysys.AnalysysAgent;
+import com.analysys.apidemo.R;
+import com.analysys.process.AgentProcess;
+import com.analysys.utils.Constants;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Copyright © 2020 Analysys Inc. All rights reserved.
+ * @Description:
+ * @Create: 2020/7/22 11:37 AM
+ * @author: huchangqing
+ */
+public class PageViewActivity extends BaseActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_page_view);
+ Switch autoTrack = findViewById(R.id.auto_track);
+ autoTrack.setChecked(AgentProcess.getInstance().getConfig().isAutoTrackPageView());
+ autoTrack.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ AgentProcess.getInstance().getConfig().setAutoTrackPageView(isChecked);
+ }
+ });
+
+ String testPageName = PageViewTestActivity.class.getName();
+
+ Button btnOpenPage = findViewById(R.id.btn_open_page);
+ btnOpenPage.setText(btnOpenPage.getText() + testPageName);
+
+ CheckBox checkBox = findViewById(R.id.cb_ignore_page);
+ checkBox.setChecked(AgentProcess.getInstance().isThisPageInPageViewBlackList(testPageName));
+ checkBox.setText(checkBox.getText() + testPageName);
+ checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ if (isChecked) {
+ List list = new ArrayList<>();
+ list.add(testPageName);
+ AnalysysAgent.setPageViewBlackListByPages(list);
+ } else {
+ AnalysysAgent.setPageViewBlackListByPages(null);
+ }
+ }
+ });
+ }
+
+ public void onClick(View view) {
+ int id = view.getId();
+ if (id == R.id.btn_open_page) {
+ Intent intent = new Intent(this, PageViewTestActivity.class);
+ intent.putExtra(BaseActivity.EXTRA_ACTIVITY_TITLE, "页面采集测试");
+ intent.putExtra(BaseActivity.EXTRA_EVENT_NAME, Constants.PAGE_VIEW);
+ startActivity(intent);
+ } else if (id == R.id.btn_manual_sigle) {
+ //服务正在开展某个活动,需要统计活动页面时
+ AnalysysAgent.pageView(this, "活动页");
+ Toast.makeText(this, "调用成功,统计【活动页】", Toast.LENGTH_LONG).show();
+ } else if (id == R.id.btn_manual_multi) {
+ //购买一部iPhone手机,手机价格为8000元
+ Map page = new HashMap<>();
+ page.put("commodityName", "iPhone");
+ page.put("commodityPrice", 8000);
+ AnalysysAgent.pageView(this, "商品页", page);
+ Toast.makeText(this, "调用成功,统计【商品页】,属性为[commodityName = iPhone, commodityPrice = 8000]", Toast.LENGTH_LONG).show();
+ }
+ }
+}
diff --git a/ans-demo/apidemo/src/main/java/com/analysys/demo/PageViewTestActivity.java b/ans-demo/apidemo/src/main/java/com/analysys/demo/PageViewTestActivity.java
new file mode 100644
index 0000000..85f3e1a
--- /dev/null
+++ b/ans-demo/apidemo/src/main/java/com/analysys/demo/PageViewTestActivity.java
@@ -0,0 +1,36 @@
+package com.analysys.demo;
+
+import android.os.Bundle;
+import android.widget.TextView;
+
+import com.analysys.ANSAutoPageTracker;
+import com.analysys.apidemo.R;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class PageViewTestActivity extends BaseActivity implements ANSAutoPageTracker {
+
+ private Map pageProperties;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_page_view_test);
+ TextView tv = findViewById(R.id.tv_page_name);
+ pageProperties = new HashMap<>();
+ pageProperties.put("name", "iphone");
+ pageProperties.put("price", 4000);
+ tv.setText("页面名字:" + getClass().getName() + "\n\n\n自定义信息 " + pageProperties.toString());
+ }
+
+ @Override
+ public Map registerPageProperties() {
+ return pageProperties;
+ }
+
+ @Override
+ public String registerPageUrl() {
+ return null;
+ }
+}
diff --git a/ans-demo/apidemo/src/main/java/com/analysys/demo/ProbeActivity.java b/ans-demo/apidemo/src/main/java/com/analysys/demo/ProbeActivity.java
new file mode 100644
index 0000000..3a8ce15
--- /dev/null
+++ b/ans-demo/apidemo/src/main/java/com/analysys/demo/ProbeActivity.java
@@ -0,0 +1,94 @@
+package com.analysys.demo;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.Switch;
+
+import com.analysys.AnalysysAgent;
+import com.analysys.apidemo.R;
+import com.analysys.process.AgentProcess;
+import com.analysys.utils.Constants;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ProbeActivity extends BaseActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_probe);
+ Switch switch0 = findViewById(R.id.auto_track_fragment);
+ switch0.setChecked(AgentProcess.getInstance().getConfig().isAutoTrackFragmentPageView());
+ switch0.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ AgentProcess.getInstance().getConfig().setAutoTrackFragmentPageView(isChecked);
+ }
+ });
+
+ switch0 = findViewById(R.id.auto_track_click);
+ switch0.setChecked(AgentProcess.getInstance().getConfig().isAutoTrackClick());
+ switch0.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ AgentProcess.getInstance().getConfig().setAutoTrackClick(isChecked);
+ }
+ });
+
+ String pageName = ProbeClickTestActivity.class.getName();
+
+ CheckBox checkBox = findViewById(R.id.auto_track_click_ignore);
+ checkBox.setText(checkBox.getText() + pageName);
+ checkBox.setChecked(AgentProcess.getInstance().isThisPageInAutoClickBlackList(pageName));
+ checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ if (isChecked) {
+ List list = new ArrayList<>();
+ list.add(pageName);
+ AnalysysAgent.setAutoClickBlackListByPages(list);
+ } else {
+ AnalysysAgent.setAutoClickBlackListByPages(null);
+ }
+ }
+ });
+
+ Button btn = findViewById(R.id.btn_open_fragment_page);
+ checkBox = findViewById(R.id.auto_track_click_ignore_button);
+ checkBox.setChecked(AgentProcess.getInstance().isThisViewTypeInAutoClickBlackList(btn.getClass()));
+ checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ if (isChecked) {
+ List list = new ArrayList<>();
+ list.add(btn.getClass());
+ AnalysysAgent.setAutoClickBlackListByViewTypes(list);
+ } else {
+ AnalysysAgent.setAutoClickBlackListByViewTypes(null);
+ }
+ }
+ });
+
+ Button btnOpenPage = findViewById(R.id.btn_open_click_page);
+ btnOpenPage.setText(btnOpenPage.getText() + pageName);
+ }
+
+ public void onClick(View view) {
+ if (view.getId() == R.id.btn_open_fragment_page) {
+ Intent intent = new Intent(this, ProbeFragmentTestActivity.class);
+ intent.putExtra(EXTRA_ACTIVITY_TITLE, "Fragment PV测试页面");
+ intent.putExtra(EXTRA_EVENT_NAME, Constants.PAGE_VIEW);
+ startActivity(intent);
+ } else if (view.getId() == R.id.btn_open_click_page) {
+ Intent intent = new Intent(this, ProbeClickTestActivity.class);
+ intent.putExtra(EXTRA_ACTIVITY_TITLE, "点击测试页面");
+ intent.putExtra(EXTRA_EVENT_NAME, Constants.USER_CLICK);
+ startActivity(intent);
+ }
+ }
+}
diff --git a/ans-demo/apidemo/src/main/java/com/analysys/demo/ProbeClickTestActivity.java b/ans-demo/apidemo/src/main/java/com/analysys/demo/ProbeClickTestActivity.java
new file mode 100644
index 0000000..a5a211f
--- /dev/null
+++ b/ans-demo/apidemo/src/main/java/com/analysys/demo/ProbeClickTestActivity.java
@@ -0,0 +1,192 @@
+package com.analysys.demo;
+
+import android.app.AlertDialog;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.ExpandableListView;
+import android.widget.ListView;
+import android.widget.RadioGroup;
+import android.widget.RatingBar;
+import android.widget.SeekBar;
+import android.widget.SimpleExpandableListAdapter;
+import android.widget.TabHost;
+
+import com.analysys.AnalysysAgent;
+import com.analysys.allgro.annotations.AnalysysIgnoreTrackClick;
+import com.analysys.apidemo.R;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class ProbeClickTestActivity extends BaseActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_probe_click_test);
+ Button btnListener = findViewById(R.id.btn_listener);
+ btnListener.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ }
+ });
+
+ Button btnLambda = findViewById(R.id.btn_lambda);
+ btnLambda.setOnClickListener(v -> {
+ });
+
+ Button btnIgnore = findViewById(R.id.btn_ignore_annotation);
+ btnIgnore.setOnClickListener(new View.OnClickListener() {
+ @Override
+ @AnalysysIgnoreTrackClick
+ public void onClick(View v) {
+ }
+ });
+
+ btnIgnore = findViewById(R.id.btn_ignore_blacklist);
+ btnIgnore.setOnClickListener(v -> {
+ });
+ AnalysysAgent.setAutoClickBlackListByView(btnIgnore);
+
+ CheckBox checkBox = findViewById(R.id.checkbox);
+ checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ }
+ });
+
+ RatingBar ratingBar = findViewById(R.id.rating_bar);
+ ratingBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
+ @Override
+ public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
+ }
+ });
+
+ SeekBar seekBar = findViewById(R.id.seek_bar);
+ seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
+ @Override
+ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+ }
+
+ @Override
+ public void onStartTrackingTouch(SeekBar seekBar) {
+ }
+
+ @Override
+ public void onStopTrackingTouch(SeekBar seekBar) {
+ }
+ });
+
+ RadioGroup radioGroup = findViewById(R.id.radio_group);
+ radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(RadioGroup group, int checkedId) {
+ }
+ });
+
+ ListView listView = findViewById(R.id.list_view);
+ List listStr = new ArrayList<>();
+ for (int i = 0; i < 10; i++) {
+ listStr.add("list row " + i);
+ }
+ listView.setAdapter(new ArrayAdapter<>(this,
+ android.R.layout.simple_list_item_1,
+ android.R.id.text1,
+ listStr));
+ listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id) {
+ }
+ });
+ listView.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+ @Override
+ public void onItemSelected(AdapterView> parent, View view, int position, long id) {
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView> parent) {
+ }
+ });
+
+ ExpandableListView expandableListView = findViewById(R.id.ex_list_view);
+ List