Skip to content

Commit 55e53ca

Browse files
committed
Add in device key
1 parent c376131 commit 55e53ca

File tree

7 files changed

+69
-66
lines changed

7 files changed

+69
-66
lines changed

snap-android-game/.idea/workspace.xml

Lines changed: 59 additions & 65 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
55 Bytes
Binary file not shown.
311 Bytes
Binary file not shown.
95 Bytes
Binary file not shown.
95 Bytes
Binary file not shown.

snap-android-game/src/org/snapscript/android/game/Agent.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public void run() {
8181
private void log() {
8282
try {
8383
Log.i(TAG, "remote-address=" + configuration.getRemoteAddress());
84+
Log.i(TAG, "process-name=" + configuration.getProcessName());
8485
Log.i(TAG, "log-level=" + configuration.getLogLevel());
8586
Log.i(TAG, "event-port=" + configuration.getEventPort());
8687
Log.i(TAG, "thread-count=" + configuration.getThreadCount());

snap-android-game/src/org/snapscript/android/game/Configuration.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package org.snapscript.android.game;
22

3+
import android.content.ContentResolver;
34
import android.content.Context;
45
import android.content.res.Resources;
6+
import android.provider.Settings;
57

68
import java.net.URI;
79

@@ -10,14 +12,20 @@ public class Configuration {
1012
private static final String PROCESS_TEMPLATE = "android-%s";
1113
private static final String ADDRESS_TEMPLATE = "http://%s:%s/resource";
1214

15+
private final ContentResolver resolver;
1316
private final Resources resources;
1417

1518
public Configuration(Context context) {
19+
this.resolver = context.getContentResolver();
1620
this.resources = context.getResources();
1721
}
1822

23+
public String getDeviceKey() {
24+
return Settings.Secure.getString(resolver, Settings.Secure.ANDROID_ID);
25+
}
26+
1927
public String getProcessName() {
20-
return String.format(PROCESS_TEMPLATE, System.currentTimeMillis());
28+
return String.format(PROCESS_TEMPLATE, getDeviceKey());
2129
}
2230

2331
public URI getRemoteAddress() {

0 commit comments

Comments
 (0)