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
Help
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 5 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)