pgyer document center
this article describes on how to integrate pgyersdk into your android apps. it allows testers to update your app to another beta version right from within the application. it will notify the tester if a new update is available. it also allows to send feedback and crash reports right from within the application. if a crash has happened, it will send information about the crash to the server immediately.
app id: the id that uniquely identifies an app in payer.com, developers can get app id from application manage page.
for eclipse
users
copy pgyersdk.jar to your project‘s libs directory.
for android studio
users add the following codes into the build.gradle file in your project:
allprojects {
repositories {
jcenter()
maven { url "https://raw.githubusercontent.com/pgyer/mvn_repo_pgyer/master" }
}
}
then add the dependency into build.gradle files in your module:
dependencies {
compile 'com.pgyersdk:sdk:2.8.0'
}
in addition to the above method 'android studio' users also can use the same methods with 'eclipse' users.
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);
}
}
don't forget to replace android:name=".pgyapplication
with your application name in the file of androidmanifest.xml
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);
}
}
find proguard/mapping.txt from your project directory.
upload the file proguard/mapping.txt to your app's page.
try
{
}
catch (exception e)
{
pgycrashmanager.reportcaughtexception(mainactivity.this, e);
}
import com.pgyersdk.feedback.pgyfeedbackshakemanager;
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();
// custom sensitivity, defaults to 950, the smaller the number higher sensitivity.
pgyfeedbackshakemanager.setshakingthreshold(1000);
// open as a dialog
pgyfeedbackshakemanager.register(mainactivity.this);
// open as an activity, in the case you must configure feedbackactivity in the file of androidmanifest.xml
pgyfeedbackshakemanager.register(mainactivity.this, false);
}
@override
protected void onpause() {
// todo auto-generated method stub
super.onpause();
pgyfeedbackshakemanager.unregister();
}
}
public void ondrawframe(gl10 gl) {
pgyfeedbackshakemanager.setglsurface(true);
glsurfaceutils.getinstance().takescreenshot(gl);
}
// open as a dialog
pgyfeedback.getinstance().show(mainactivity.this);
// open as an activity, in the case you must configure feedbackactivity in the file of androidmanifest.xml
pgyfeedback.getinstance().showactiivty(mainactivity.this);
pgyerdialog.setdialogtitlebackgroundcolor("#ff0000");
pgyerdialog.setdialogtitletextcolor("#ffffff");
// set navigation and bottom bar background
feedbackactivity.setbarbackgroundcolor("#ff0000");
// set button backgournd when pressed.
feedbackactivity.setbarbuttonpressedcolor("#ff0000");
// set color picker background
feedbackactivity.setcolorpickerbackgroundcolor("#ff0000");
pgyupdatemanager.register(this);
pgyupdatemanager.register(mainactivity.this,
new updatemanagerlistener() {
@override
public void onupdateavailable(final string result) {
// encapsulates new version information into appbean
final appbean appbean = getappbeanfromstring(result);
new alertdialog.builder(mainactivity.this)
.settitle("update available")
.setmessage("")
.setnegativebutton(
"ok",
new dialoginterface.onclicklistener() {
@override
public void onclick(
dialoginterface dialog,
int which) {
startdownloadtask(
mainactivity.this,
appbean.getdownload);
}
}).show();
}
@override
public void onnoupdateavailable() {
}
});
-libraryjars libs/pgyer_sdk_android_2.8.0.jar
-dontwarn com.pgyersdk.**
-keep class com.pgyersdk.** { *; }