Pgyer internal test distribution service is a leading mobile application internal test distribution platform in China, dedicated to providing easy-to-use App internal test distribution services for mobile developers and test users.
Pgyer Developer Service Platform is committed to providing excellent upstream and downstream services for developers, addressing the various needs of developers throughout the developer life cycle.
Scan QR code to follow
Pgyer WeChat Official Account
Get the latest news, official benefits, promotions and other information
Pgyer document center
App Key:唯一标识一个应用的 Key,在蒲公英上的每一个 App 都有一个唯一的 App Key,开发者可以在应用管理页面首页查看。
将 jar 包复制到工程的 libs 目录下面。
添加代码到project下的build.gradle文件中:
allprojects {
repositories {
jcenter()
maven { url "https://raw.githubusercontent.com/Pgyer/mvn_repo_pgyer/master" }
}
}
然后在module下的build.gradle文件中添加依赖即可:
dependencies {
compile 'com.pgyersdk:sdk:2.8.1'
}
Android Studio
用户除了可以使用以上方法集成SDK外,也可以使用和Eclipse
用户相同的方法来集成SDK。
<!-- 必选-->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- 获取网络状态 -->
<uses-permission android:name="android.permission.INTERNET" /> <!-- 网络通信-->
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> <!-- 获取设备信息 -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 获取MAC地址-->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- 读写sdcard,storage等等 -->
<uses-permission android:name="android.permission.RECORD_AUDIO" /> <!-- 允许程序录制音频 -->
<uses-permission android:name="android.permission.GET_TASKS"/>
<!-- 可选-->
<uses-permission android:name="android.permission.READ_LOGS" /> <!-- 获取logcat日志 -->
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<!-- 可选-->
<activity android:name="com.pgyersdk.activity.FeedbackActivity"/>
<!-- 必选-->
<meta-data
android:name="PGYER_APPID"
android:value="4b6e8877dfcc2462bedb37dcf66b6d87" >
</meta-data>
</application>
注意:
APPID 即 App Key
注意:
Android6.0以上需要应用内部动态申请读写权限。
import com.pgyersdk.crash.PgyCrashManager;
import android.app.Application;
public class PgyApplication extends Application {
@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
PgyCrashManager.register(this);
}
}
在 AndroidManifest.xml 注意修改 android:name=".PgyApplication
"此处的名字对应上面继承 Application 的类名
<application
android:name=".PgyApplication"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
</application>
import com.pgyersdk.crash.PgyCrashManager;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
PgyCrashManager.register(this);
}
}
PgyCrashManager.unregister();
通过 progurad 工具混淆时,工程目录下会自动生成符号表文件 mapping.txt
在后台配置符号表文件
try {
// code
} catch (Exception e) {
PgyCrashManager.reportCaughtException(MainActivity.this, e);
}
import com.pgyersdk.feedback.PgyFeedbackShakeManager;
import com.pgyersdk.update.UpdateManagerListener;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
// 自定义摇一摇的灵敏度,默认为950,数值越小灵敏度越高。
PgyFeedbackShakeManager.setShakingThreshold(1000);
// 以对话框的形式弹出,对话框只支持竖屏
PgyFeedbackShakeManager.register(MainActivity.this);
// 以Activity的形式打开,这种情况下必须在AndroidManifest.xml配置FeedbackActivity
// 打开沉浸式,默认为false
// FeedbackActivity.setBarImmersive(true);
//PgyFeedbackShakeManager.register(MainActivity.this, true); 相当于使用Dialog的方式;
PgyFeedbackShakeManager.register(MainActivity.this, false);
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
PgyFeedbackShakeManager.unregister();
}
}
// 以对话框的形式弹出
PgyFeedback.getInstance().showDialog(MainActivity.this);
// 以Activity的形式打开,这种情况下必须在AndroidManifest.xml配置FeedbackActivity
// 打开沉浸式,默认为false
// FeedbackActivity.setBarImmersive(true);
PgyFeedback.getInstance().showActivity(MainActivity.this);
注
:使用Activity弹出的方式,还需要添加以下代码:
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
PgyFeedbackShakeManager.unregister();
}
PgyerDialog.setDialogTitleBackgroundColor("#ff0000");
PgyerDialog.setDialogTitleTextColor("#ffffff");
// 设置顶部导航栏和底部bar的颜色
FeedbackActivity.setBarBackgroundColor("#ff0000");
// 设置顶部按钮和底部按钮按下时的反馈色
FeedbackActivity.setBarButtonPressedColor("#ff0000");
// 设置颜色选择器的背景色
FeedbackActivity.setColorPickerBackgroundColor("#ff0000");
PgyFeedback.getInstance().setMoreParam("tao","value");
将在用户反馈的详情界面看到自定义的数据,如下图:
import com.pgyersdk.update.PgyUpdateManager;
PgyUpdateManager.setIsForced(true); //设置是否强制更新。true为强制更新;false为不强制更新(默认值)。
PgyUpdateManager.register(this);
import com.pgyersdk.javabean.AppBean;
import com.pgyersdk.update.PgyUpdateManager;
import com.pgyersdk.update.UpdateManagerListener;
PgyUpdateManager.register(MainActivity.this,
new UpdateManagerListener() {
@Override
public void onUpdateAvailable(final String result) {
// 将新版本信息封装到AppBean中
final AppBean appBean = getAppBeanFromString(result);
new AlertDialog.Builder(MainActivity.this)
.setTitle("更新")
.setMessage("")
.setNegativeButton(
"确定",
new DialogInterface.OnClickListener() {
@Override
public void onClick(
DialogInterface dialog,
int which) {
startDownloadTask(
MainActivity.this,
appBean.getDownloadURL());
}
}).show();
}
@Override
public void onNoUpdateAvailable() {
}
});
UpdateManagerListener.updateLocalBuildNumber(result);
PgyUpdateManager.unregister();
result的格式为:
-libraryjars libs/pgyer_sdk_x.x.jar
-dontwarn com.pgyersdk.**
-keep class com.pgyersdk.** { *; }
About Us
Product Services
Your account information is under review and can not be used temporarily; you can:
Check out the help documentation for common ways to work on the Pgyer's platform;
Check Pgyer's App Auditing , which must be viewed before uploading.
Currently, the real-name authentication has not been completed, and the number of downloads for each version is limited to 0 times/day, After real-name authentication, it can be extended to 500 times/day
TestFlight is only available to Professional users.(Click understand pgyer's price plan)
支付成功
Pgyer VIP User Group
(Please open WeChat - Sweep and join the group chat)