一、版本兼容

==仅支持 1.5.0 版本以上sdk==

二、接口方法

1.创建路径对象

MobileRoute route = MobileRoute.maker("GameBox")
                            .store();

2.获取路径对象

MobileRoute route = MobileRoute.get("GameBox");

3.添加路径节点

MobileRoute.ViewPoint point = MobileRoute.ViewPoint.maker()
                            .title("MainActivity");
                            .property("key1", "value1")
                            .create();
route.add(point)

4.移除路径节点

route.remove(point)
route.remove(point.getId())

5.清空路径

route.clear();

4.路径提交

触发提交事件时, 数据中将夹带全路径信息提交

//普通事件提交
MobileEvent.maker()
           .route(route.toString())
           .commit();

三、使用方式

页面显示时提交路径

//Activity

public class MainActivity extends AppCompatActivity {
    private MobileRoute mRoute;
    private MobileRoute.ViewPoint mPoint;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        mRoute = MobileRoute.maker("GameBox")
                           .store();
    }
    
    
    @Override
    protected void onResume() {
        super.onResume();
        
        mPoint = MobileRoute.ViewPoint.maker()
                                    .title("MainActivity")
                                    .propery("key1", "value")
                                    .create();
        mRoute.add(mPoint);
    }
    
    
    @Override
    protected void onStop() {
        super.onStop();
        
        mRoute.remove(mPoint);
        //mRoute.remove(mPoint.getId());
    }
    
}

四、数据结构

  1. 页面间以-分隔,元素以[]括起来,以 K=V形式
  2. 记录每个页面的名称,页面需要有出栈入栈规则, 进入某一页面 入栈,退出该页面,则该页面出栈。 例如:主页-找游戏-主页-找游戏-喜欢-游戏搜索-联想-搜索结果[word=拳皇命运]-游戏 则记录为:主页-找游戏-喜欢-游戏搜索-联想-搜索结果[word=拳皇命运]-游戏
  3. 以事件发生为结束标志上报,上报事件时发送路径
  4. 若该页面没有发生行为,且发生回退,则该页面不记录,失效
  5. 路径需要带元素,以K=V形式上报,不同元素间以[]分隔 元素规则: [word="王者荣耀"] [gameid="119495"][game="绝地求生=刺激战场(国际版体验服)"]