移动开发测试工具——Bugtags
注册开发者账号
注册账号并激活邮箱,都会就不多做介绍了。
创建应用
创建完账号以后会提示添加应用,点击添加
添加应用
创建成功
集成
官方集成文档(需要登录):https://bugtags.com/console/apps/1511810667643079/sdk/integration
1. 导入Lib库
Eclipse集成可以通过手动过下载SDK获取到库,Android Studio可以直接通过gradle依赖
2. 添加权限
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_LOGS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
3. 注册Activity和Service
<activity
android:name="com.bugtags.library.BugtagsActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<receiver android:name="com.bugtags.library.BugtagsReceiver" >
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
</receiver>
<service android:name="com.bugtags.library.BugtagsService" />
4. 添加回调
在你的Activity基类中添加三个回调
package com.kongqw.kqwbugtagsdemo;
import android.app.Activity;
import android.view.MotionEvent;
import com.bugtags.library.Bugtags;
/**
* Created by kongqw on 2015/9/9.
*/
public class CustomActivity extends Activity {
@Override
protected void onResume() {
super.onResume();
//注:回调 1
Bugtags.onResume(this);
}
@Override
protected void onPause() {
super.onPause();
//注:回调 2
Bugtags.onPause(this);
}
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
//注:回调 3
Bugtags.onDispatchTouchEvent(this, event);
return super.dispatchTouchEvent(event);
}
}
5. 让程序中里的Activity继承CustomActivity
6. 在Application中初始化BugTags
在清单文件(AndroidManifest.xml)的application标签下添加name属性
android:name=".InItApplication"
初始化(这里的App Key是我的测试App的key,要换成自己的)
package com.kongqw.kqwbugtagsdemo;
import android.app.Application;
import com.bugtags.library.Bugtags;
/**
* Created by kongqw on 2015/9/9.
*/
public class InItApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
//在这里初始化
Bugtags.start("f525c956b77f8453b16357a8921c3efd", this, Bugtags.BTGInvocationEventBubble);
}
}