Skip to content

Commit

Permalink
modify files
Browse files Browse the repository at this point in the history
Summary:
modify file #123 #126 #122 #121 #115

modify file

Reviewers: nan.li

Reviewed By: nan.li

Differential Revision: http://pha.cobub.cn/D91
  • Loading branch information
Xuduzhou committed Aug 19, 2015
1 parent 3e4920e commit 6727ca2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
3 changes: 2 additions & 1 deletion sdk/android_sdk/SDK/src/com/wbtech/ums/CommonUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public static void saveInfoToFile(String type, JSONObject info,
newdata.put(0, info);
JSONObject jsonObject = new JSONObject();
jsonObject.put(type, newdata);
Thread t = new SaveInfo(context, jsonObject);
String cacheFile = context.getCacheDir()+"/cobub.cache";
Thread t = new SaveInfo( jsonObject,cacheFile);
t.run();

} catch (Exception e) {
Expand Down
20 changes: 10 additions & 10 deletions sdk/android_sdk/SDK/src/com/wbtech/ums/SaveInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,29 @@
* @author duzhou.xu
*/
class SaveInfo extends Thread {
public Context context;
public JSONObject object;
private final String tag = "SaveInfo";
private String path = "";

public SaveInfo(Context context, JSONObject object) {
public SaveInfo( JSONObject object,String path) {
super();
this.object = object;
this.context = context;
this.path = path;
}

@Override
public void run() {
super.run();
File file;

String cacheFile = context.getCacheDir()+"/cobub.cache";
CobubLog.d(tag,"Save cache file "+cacheFile);

CobubLog.d(tag,"Save cache file "+path);
CobubLog.d(tag,"json data "+object.toString());

JSONObject existJSON = null;
try {

file = new File(cacheFile);
file = new File(path);
if (file.exists())
{
CobubLog.i(tag, "file exist " + file.getAbsolutePath());
Expand All @@ -66,10 +66,10 @@ public void run() {
//
if (file.length() > 1024 * 1024) {
file.delete();
file = new File(cacheFile);
file = new File(path);
file.createNewFile();
}
FileInputStream in = new FileInputStream(cacheFile);
FileInputStream in = new FileInputStream(path);
StringBuffer sb = new StringBuffer();

int i = 0;
Expand Down Expand Up @@ -97,7 +97,7 @@ public void run() {
}
}
FileOutputStream fileOutputStream = new FileOutputStream(
cacheFile, false);
path, false);
fileOutputStream.write(existJSON.toString().getBytes());
fileOutputStream.flush();
fileOutputStream.close();
Expand All @@ -115,7 +115,7 @@ public void run() {
jsonObject.put("appkey", AppInfo.getAppKey());

FileOutputStream fileOutputStream = new FileOutputStream(
cacheFile, false);
path, false);
fileOutputStream.write(jsonObject.toString().getBytes());
fileOutputStream.flush();
fileOutputStream.close();
Expand Down
2 changes: 1 addition & 1 deletion sdk/android_sdk/Sample/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

<meta-data
android:name="UMS_APPKEY"
android:value="d2105e352a1644605c8dc7954fb39d46" />
android:value="fa21d3716499a7a6747b63cad6a83778" />

<activity
android:name="com.wbtech.test_sample.SecondActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class MainActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final String event_name = "btn_click";
final String event_name = "click";
Button button_event = (Button) findViewById(R.id.button_event);
Button button_error = (Button) findViewById(R.id.button_error);
Button button_activity = (Button) findViewById(R.id.button_activity);
Expand All @@ -54,7 +54,7 @@ public void onCreate(Bundle savedInstanceState) {
// UmsAgent.setBaseURL("http://192.168.1.55/razor/web/index.php?");

// String urlPrefix = "http://www.cobub.com/razor/index.php?";
String urlPrefix = "http://42.123.76.99/21cn";
String urlPrefix = "http://192.168.1.105/razorgit/opencobub/web/index.php?";
txtURL.setText("Server URL:"+urlPrefix);

UmsAgent.init(this, urlPrefix);
Expand All @@ -78,6 +78,7 @@ public void onCreate(Bundle savedInstanceState) {

UmsAgent.update(this);
UmsAgent.updateOnlineConfig(this);
UmsAgent.postTags(this,"test tags");

/**
* SDK could help you catch exit exception during App usage and send
Expand Down Expand Up @@ -111,7 +112,8 @@ public void onCreate(Bundle savedInstanceState) {
* Activity. Parameter is context of current context. Then, client data
* could be posted to Cobub Razor system.
*/

UmsAgent.postCID(this, "cid");
UmsAgent.postUserIdentifier(this, "user id");

button_event.setOnClickListener(new OnClickListener() {

Expand Down

0 comments on commit 6727ca2

Please sign in to comment.