Skip to content

Commit 98c0fc2

Browse files
committed
Fixed some bugs and improvements
1 parent bf7330a commit 98c0fc2

3 files changed

Lines changed: 20 additions & 17 deletions

File tree

app/src/main/java/com/pingmelive/application.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public void onCreate() {
1212
.setErrorEventEnabled(true)
1313
.setErrorEventTitle("ERROR_TITLE")
1414
.setAPI_KEY("YOUR_API_KEY")
15-
.setAPP_ID("YOUR_APP_ID")
15+
.setPROJECT_ID("YOUR_APP_ID")
1616
.install();
1717
}
1818
}

pingmelive/src/main/java/com/pingmelive/pingMeLive.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ protected pingMeLive(Builder builder) {
5858
this.builder = builder;
5959
}
6060

61-
public static void install(@Nullable final Context context,boolean errorEvents, final String errorEventTitle, String APIKEY,String appId) {
61+
public static void install(@Nullable final Context context,boolean errorEvents, final String errorEventTitle, String API_KEY,String PROJECT_ID) {
6262

6363
if(errorEvents) {
6464
try {
@@ -73,23 +73,23 @@ public static void install(@Nullable final Context context,boolean errorEvents,
7373
return;
7474
}
7575

76-
if (APIKEY == null || APIKEY.trim().length() <= 0) {
76+
if (API_KEY == null || API_KEY.trim().length() <= 0) {
7777
Log.e(TAG, "API KEY needed check your application class");
7878
Log.e(TAG, "pingMeLive not installed.");
7979
return;
8080
}
8181

82-
if (appId == null || appId.trim().length() <= 0) {
83-
Log.e(TAG, "appId needed check your application class");
82+
if (PROJECT_ID == null || PROJECT_ID.trim().length() <= 0) {
83+
Log.e(TAG, "PROJECT_ID needed check your application class");
8484
Log.e(TAG, "pingMeLive not installed.");
8585
return;
8686
}
8787

8888
dbHelper = DBHelper.getInstance(context);
8989
pingMePref = com.pingmelive.pingMePref.getInstance(context);
9090

91-
pingMePref.setAPIKey(APIKEY);
92-
pingMePref.setAppId(appId);
91+
pingMePref.setAPIKey(API_KEY);
92+
pingMePref.setAppId(PROJECT_ID);
9393

9494
//INSTALL!
9595
final Thread.UncaughtExceptionHandler oldHandler = Thread.getDefaultUncaughtExceptionHandler();
@@ -144,13 +144,13 @@ public void uncaughtException(Thread thread, final Throwable throwable) {
144144
}
145145
else {
146146

147-
if (APIKEY == null || APIKEY.trim().length() <= 0) {
147+
if (API_KEY == null || API_KEY.trim().length() <= 0) {
148148
Log.e(TAG, "API KEY needed check your application class");
149149
Log.e(TAG, "pingMeLive not installed.");
150150
return;
151151
}
152152

153-
if (appId == null || appId.trim().length() <= 0) {
153+
if (PROJECT_ID == null || PROJECT_ID.trim().length() <= 0) {
154154
Log.e(TAG, "appId needed check your application class");
155155
Log.e(TAG, "pingMeLive not installed.");
156156
return;
@@ -162,8 +162,8 @@ public void uncaughtException(Thread thread, final Throwable throwable) {
162162
dbHelper = DBHelper.getInstance(context);
163163
pingMePref = com.pingmelive.pingMePref.getInstance(context);
164164

165-
pingMePref.setAPIKey(APIKEY);
166-
pingMePref.setAppId(appId);
165+
pingMePref.setAPIKey(API_KEY);
166+
pingMePref.setAppId(PROJECT_ID);
167167

168168
dbHelper.sendData();
169169
}
@@ -255,7 +255,7 @@ public static class Builder {
255255
boolean ErrorEventEnabled = true;
256256
String ErrorEventTitle = null;
257257
String API_KEY = null;
258-
String APP_ID = null;
258+
String PROJECT_ID = null;
259259
Context context;
260260

261261
public Builder(Context context)
@@ -290,17 +290,17 @@ public Builder setAPI_KEY(String API_KEY) {
290290
return this;
291291
}
292292

293-
String getAPP_ID() {
294-
return APP_ID;
293+
public String getPROJECT_ID() {
294+
return PROJECT_ID;
295295
}
296296

297-
public Builder setAPP_ID(String APP_ID) {
298-
this.APP_ID = APP_ID;
297+
public Builder setPROJECT_ID(String PROJECT_ID) {
298+
this.PROJECT_ID = PROJECT_ID;
299299
return this;
300300
}
301301

302302
public void install() {
303-
pingMeLive.install(context,isErrorEventEnabled(),getErrorEventTitle(),getAPI_KEY(),getAPP_ID());
303+
pingMeLive.install(context,isErrorEventEnabled(),getErrorEventTitle(),getAPI_KEY(),getPROJECT_ID());
304304
}
305305
}
306306
}

pingmelive/src/main/java/com/pingmelive/sendLogToServer.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public void sync_local_to_server(final pingModel pingModel) {
8585
@Override
8686
public void onResponse(String response) {
8787

88+
Log.e("API Response",""+response);
8889
Log.e("Data","Sent to server");
8990
dbHelper.removeEvent(pingModel.getId());
9091

@@ -119,6 +120,7 @@ public byte[] getBody() throws AuthFailureError {
119120
}
120121
String str = jsonObject.toString();
121122

123+
Log.e("API Body",jsonObject.toString());
122124
return str.getBytes();
123125
}
124126

@@ -131,6 +133,7 @@ public Map<String, String> getHeaders() {
131133
headers.put("apikey",pingMePref.getAPIKey());
132134
headers.put("projectid",pingMePref.getAppId());
133135

136+
Log.e("API Header",headers.toString());
134137
return headers;
135138
}
136139

0 commit comments

Comments
 (0)