GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - liuhao722/PingBack: 埋点汇报类

BranchesTags
Open more actions menu

Latest commit

 

History

23 Commits
23 Commits

Folders and files

NameName
Last commit message
Last commit date
app
app
 
 
gradle/wrapper
gradle/wrapper
 
 
pingback
pingback
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
build.gradle
build.gradle
 
 
gradle.properties
gradle.properties
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
settings.gradle
settings.gradle
 
 

Repository files navigation

PingBack埋点汇报辅助

使用方法:

AndroidStudio中gradle引入:
implementation 'yunzhe.plugin:PingBack:1.0.2'
如果遇到引入失败:出现以下错误
ERROR: Failed to resolve: yunzhe.plugin:PingBack:1.0.2
解决办法:

那么请在项目根root中的build.gradle文件中添加

buildscript {
    repositories {
        google()
        maven { url "https://dl.bintray.com/liukun722914/Pingback" }
        jcenter()
    }
}

allprojects {
    repositories {
        google()
        maven { url "https://dl.bintray.com/liukun722914/Pingback" }
        jcenter()
    }
}
初始化插件
public class BaseApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        //  new SensorKeys() 为你所有要发送的埋点Key集合类
        //  格式  
        {
            /**
                对目前神策要回传的事件key进行统一管理
                在初始化的时候统一的反射属性进行创建
                Created by LiuHao on 2017/11/22
                
                public final class SensorKeys {
                    //keys
                    public static final String Authorization = "Authorization";                                     //  用户授权信息
                    public static final String Login = "Login";                                                     //  登录
                    public static final String ClickRegister = "ClickRegister";                                     //  注册
                    public static final String FindPassword = "FindPassword";                                       //  找回密码
                }
            
            */
        }
        PingBackHelper.ins().initKeys(new SensorKeys());
    }
}
具体使用方式:
//  方式一:根据key进行获取指定的集合,该集合根据个人情况进行决定是否清除原有的数据
YZHashMap<String, Object> map = PingBackHelper.getMap(SensorKeys.Authorization);
map.put("title", "个人中心");
map.put("desc", "点击了个人中心");
// send(request, map);

//  方式一衍生:不需要之前信息可以先调用clear进行清除
YZHashMap<String, Object> mapClear = PingBackHelper.getMap(SensorKeys.Authorization);
mapClear.clear();
mapClear.put("title", "个人中心");
mapClear.put("desc", "点击了个人中心");
// send(request, mapClear);

//  方式二 根据指定的Key获取已经存储的信息JsonObject对象
JSONObject jsonObject = PingBackHelper.getJSONObject(SensorKeys.Authorization);
jsonObject.put("time", System.currentTimeMillis());
// send(request, jsonObject);

//  方式三 获取一个新的JsonObject对象进行key-value存储
YZJSONObject jsonObjectInstance = PingBackHelper.getJSONObject();
jsonObjectInstance.put("title", "个人中心");
jsonObjectInstance.put("desc", "点击了个人中心");
// send(request, jsonObjectInstance);

About

埋点汇报类

Resources

Readme
Activity

Stars

1 star

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.