Skip to content

Commit ebed5fc

Browse files
Emre DemirEmre Demir
authored andcommitted
Extra cleaning up.
1 parent c06e484 commit ebed5fc

File tree

6 files changed

+3
-211
lines changed

6 files changed

+3
-211
lines changed

Source/GDApi/gdapi/src/main/java/com/gd/analytics/GDCallback.java

Lines changed: 0 additions & 13 deletions
This file was deleted.

Source/GDApi/gdapi/src/main/java/com/gd/analytics/GDad.java

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ public class GDad {
3535
private FrameLayout rootview;
3636
private RelativeLayout relativeLayoutContainer;
3737
private boolean bannerActive = false;
38-
private String deviceID = null;
3938
private boolean isCordovaPlugin = false;
4039

4140
public void init(Activity mContext) {
@@ -90,9 +89,6 @@ private void requestBanner(String size, String alignment, String position) {
9089
PublisherAdRequest.Builder builder = new PublisherAdRequest.Builder();
9190
builder.addNetworkExtrasBundle(AdMobAdapter.class, cust_params);
9291

93-
if (this.deviceID != null) {
94-
builder.addTestDevice(this.deviceID);
95-
}
9692
adRequest = builder.build();
9793
handleBannerParams(size, alignment, position);
9894

@@ -177,9 +173,6 @@ private void requestInterstitial() {
177173
PublisherAdRequest.Builder builder = new PublisherAdRequest.Builder();
178174
builder.addNetworkExtrasBundle(AdMobAdapter.class, cust_params);
179175

180-
if (this.deviceID != null) {
181-
builder.addTestDevice(this.deviceID);
182-
}
183176
adRequest = builder.build();
184177

185178
if (this.isCordovaPlugin) {
@@ -326,39 +319,6 @@ public void showBanner(String args) {
326319

327320
}
328321

329-
public String getDeviceID() {
330-
String android_id = Settings.Secure.getString(getmContext().getContentResolver(), Settings.Secure.ANDROID_ID);
331-
332-
if (android_id != null && android_id.length() > 0) {
333-
return md5(android_id).toUpperCase();
334-
} else {
335-
return md5("emulator").toUpperCase();
336-
}
337-
}
338-
339-
public void setDeviceID(String deviceID) {
340-
this.deviceID = deviceID;
341-
}
342-
343-
public String md5(String s) {
344-
try {
345-
// Create MD5 Hash
346-
MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
347-
digest.update(s.getBytes());
348-
byte messageDigest[] = digest.digest();
349-
350-
// Create Hex String
351-
StringBuffer hexString = new StringBuffer();
352-
for (int i = 0; i < messageDigest.length; i++)
353-
hexString.append(Integer.toHexString(0xFF & messageDigest[i]));
354-
return hexString.toString();
355-
356-
} catch (NoSuchAlgorithmException e) {
357-
e.printStackTrace();
358-
}
359-
return "";
360-
}
361-
362322
public void destroyBanner() {
363323
if (publisherAdView != null && bannerActive) {
364324
publisherAdView.destroy();

Source/GDApi/gdapi/src/main/java/com/gd/analytics/GDbanner.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ class GDbanner {
2121
protected static void init() {
2222

2323
if(GDstatic.enable) {
24-
2524
GDHttpRequest.sendHttpRequest(GDlogger.mContext, GDstatic.GAME_API_URL, Request.Method.GET, null, new GDHttpCallback() {
2625
@Override
2726
public void onSuccess(JSONObject data) {
@@ -51,14 +50,11 @@ public void onError(VolleyError error) {
5150
GDutils.log("Something went wrong fetching json game data.");
5251
}
5352
});
54-
55-
5653
}
5754
}
5855

5956
protected static void ShowBanner(String args) {
6057

61-
6258
Gson gson = new Gson();
6359
final GDshowObj gDshowObj;
6460
gDshowObj = gson.fromJson(args, GDshowObj.class);

Source/GDApi/gdapi/src/main/java/com/gd/analytics/GDlogger.java

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.app.Activity;
44
import android.content.SharedPreferences;
55
import android.preference.PreferenceManager;
6+
import android.support.annotation.Nullable;
67
import android.util.Log;
78

89
import com.google.android.gms.common.ConnectionResult;
@@ -129,18 +130,6 @@ public static void setAdListener(GDadListener gDadListener) {
129130
gDad.setAdListener(gDadListener);
130131
}
131132

132-
public static void addTestDevice(String deviceID) {
133-
if (gDad != null)
134-
gDad.setDeviceID(deviceID);
135-
}
136-
137-
public static String getTestDevice() {
138-
if (gDad != null)
139-
return gDad.getDeviceID();
140-
else
141-
return null;
142-
}
143-
144133
/**
145134
* GDlogger hides banner
146135
*/
@@ -170,8 +159,4 @@ public static boolean checkPlayServices(Activity activity) {
170159

171160
}
172161

173-
public static boolean isInternetAvailable() {
174-
return GDutils.internetConnectionAvailable();
175-
}
176-
177162
}

Source/GDApi/gdapi/src/main/java/com/gd/analytics/GDstatic.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22

33
class GDstatic {
44

5-
protected static final float apiVersion = (float) 1.0;
6-
protected static final String version = "v1.0";
7-
protected static final String PREFS_NAME = "GDPrefsFile";
85
protected static final String GAME_API_URL = "https://game.api.gamedistribution.com/game/get";
6+
protected static final String TUNNL_TAG_URL = "https://ana.tunnl.com"; // /at?id={{game-id}}&pageurl={{bundle-name}}
7+
protected static final String version = "v1.0";
98
protected static Boolean enable = false;
109
protected static Boolean debug = false;
1110
protected static String serverId;
1211
protected static String regId;
1312
protected static String gameId;
14-
protected static String sVersion = "v1";
1513
protected static boolean reqBannerEnabled = true;
1614
protected static boolean reqInterstitialEnabled = true;
1715
protected static String adUnit;

Source/GDApi/gdapi/src/main/java/com/gd/analytics/GDutils.java

Lines changed: 0 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,12 @@
44
import android.app.ActivityManager.RunningTaskInfo;
55
import android.content.ComponentName;
66
import android.content.Context;
7-
import android.content.Intent;
8-
import android.content.SharedPreferences.Editor;
9-
import android.net.Uri;
107
import android.util.Log;
118

12-
import org.apache.http.NameValuePair;
13-
import org.apache.http.message.BasicNameValuePair;
14-
15-
import java.io.UnsupportedEncodingException;
16-
import java.net.InetAddress;
17-
import java.net.URLEncoder;
18-
import java.net.UnknownHostException;
19-
import java.util.ArrayList;
20-
import java.util.Arrays;
219
import java.util.List;
22-
import java.util.concurrent.Callable;
23-
import java.util.concurrent.ExecutionException;
24-
import java.util.concurrent.Executors;
25-
import java.util.concurrent.Future;
26-
import java.util.concurrent.TimeUnit;
27-
import java.util.concurrent.TimeoutException;
2810

2911
final class GDutils {
3012
private static final String LOG_TAG = "GD";
31-
private static String OpenedURL = "";
3213

3314
public GDutils() {
3415
// TODO Auto-generated constructor stub
@@ -39,86 +20,6 @@ protected static void log(String msg) {
3920
if (GDstatic.debug) Log.i(LOG_TAG, msg);
4021
}
4122

42-
protected static String sessionId() {
43-
String text = new String("");
44-
String possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
45-
46-
int index = 0;
47-
for (int i = 0; i < 32; i++) {
48-
index = (int) Math.floor(Math.random() * possible.length());
49-
text = text.concat(possible.substring(index, index + 1));
50-
}
51-
return text.trim();
52-
}
53-
54-
protected static void compareVersions(float andver) {
55-
if (GDstatic.apiVersion < andver) {
56-
log("Your GDApi (version: " + GDstatic.apiVersion + ") is out of date. We strongly recommend you to use the newest version (" + andver + ") to access all features of GDApi.\nhttps://github.com/GameDistribution/GD-Android-Java");
57-
}
58-
}
59-
60-
protected static int getCookie(String key) {
61-
try {
62-
return GDlogger.appSharedPrefs.getInt(key, 0);
63-
} catch (Exception e) {
64-
return 0;
65-
}
66-
}
67-
68-
protected static void setCookie(String key, int value) {
69-
// TODO Auto-generated method stub
70-
Editor prefsEditor = GDlogger.appSharedPrefs.edit();
71-
prefsEditor.putInt(key, value);
72-
prefsEditor.commit();
73-
}
74-
75-
protected static String[] removeElement(String[] input, String deleteMe) {
76-
if (input != null) {
77-
List<String> list = new ArrayList<String>(Arrays.asList(input));
78-
for (int i = 0; i < list.size(); i++) {
79-
if (list.get(i).equals(deleteMe)) {
80-
list.remove(i);
81-
}
82-
}
83-
return list.toArray(new String[0]);
84-
} else {
85-
return new String[0];
86-
}
87-
}
88-
89-
protected static String[] removeElementAt(String[] input, int index) {
90-
if (input != null) {
91-
List<String> list = new ArrayList<String>(Arrays.asList(input));
92-
list.remove(index);
93-
return list.toArray(new String[0]);
94-
} else {
95-
return new String[0];
96-
}
97-
}
98-
99-
100-
protected static int OpenURL(String _url, String _target, Boolean _reopen) throws ExecutionException {
101-
int res = 1500;
102-
if (GDstatic.enable) {
103-
if (_reopen) {
104-
OpenedURL = "";
105-
res = 1501;
106-
} else if (OpenedURL != _url) {
107-
if (!_url.startsWith("http://") && !_url.startsWith("https://")) {
108-
_url = "http://" + _url;
109-
}
110-
111-
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(_url));
112-
GDlogger.mContext.startActivity(browserIntent);
113-
114-
OpenedURL = _url;
115-
res = 1502;
116-
}
117-
return res;
118-
} else {
119-
return res;
120-
}
121-
}
12223

12324
protected static boolean isApplicationBroughtToBackground() {
12425
try {
@@ -136,39 +37,4 @@ protected static boolean isApplicationBroughtToBackground() {
13637
return false;
13738
}
13839

139-
static <T> boolean typeOf(T value) {
140-
if (value instanceof Integer) {
141-
return true;
142-
} else if (value instanceof String) {
143-
return true;
144-
} else if (value instanceof Boolean) {
145-
return true;
146-
} else
147-
return false;
148-
}
149-
150-
static boolean internetConnectionAvailable() {
151-
int timeOut = 2000;
152-
153-
InetAddress inetAddress = null;
154-
try {
155-
Future<InetAddress> future = Executors.newSingleThreadExecutor().submit(new Callable<InetAddress>() {
156-
@Override
157-
public InetAddress call() {
158-
try {
159-
return InetAddress.getByName("google.com");
160-
} catch (UnknownHostException e) {
161-
return null;
162-
}
163-
}
164-
});
165-
inetAddress = future.get(timeOut, TimeUnit.MILLISECONDS);
166-
future.cancel(true);
167-
} catch (InterruptedException e) {
168-
} catch (ExecutionException e) {
169-
} catch (TimeoutException e) {
170-
}
171-
return inetAddress != null && !inetAddress.equals("");
172-
}
173-
17440
}

0 commit comments

Comments
 (0)