IEnumerator lmsAppInfo( string appID, string deviceID, LMSVersionUpdateCallback callback ) { // make JSON JSONObject j = new JSONObject(JSONObject.Type.OBJECT); //number j.AddField("action", "ApplicationVersion"); // make param area JSONObject arr = new JSONObject(JSONObject.Type.ARRAY); j.AddField("params", arr); // add params arr.AddField ("app_id",appID); arr.AddField ("device",deviceID); // add authkey j.AddField ("authKey",MedstarNow_ActivationCode); // get the string string bodyString = j.print(); LMSDebug ("LMSIntegration.lmsAppInfo(" + appID + "," + deviceID + ") : bodystring=<" + bodyString + ">"); // Create a download object WWW download = new WWW(APPINFO_URL,Encoding.ASCII.GetBytes(bodyString),pingHeaders); yield return download; string DBResult; string DBErrorString; if (download.error != null) { // save the error DBResult = ""; DBErrorString = download.error; // decode return JSONObject decoder = new JSONObject(download.text); JSONObject msg = decoder.GetField ("msg"); if ( msg != null ) UnityEngine.Debug.LogError("LMSIntegration.lmsAppInfo() : error=" + download.error + " msg=" + msg.print()); else UnityEngine.Debug.LogError("LMSIntegration.lmsAppInfo() : error=" + download.error); // bad return if ( callback != null ) callback(false,"error","error","none",download); } else { // decode JSONObject decoder = new JSONObject(download.text); if ( CheckReturn(decoder) == true ) { JSONObject p = decoder.GetField ("params"); if ( p != null ) { JSONObject version = p.GetField ("appver"); JSONObject update = p.GetField ("force_update"); string msg = "LMSIntegration.lmsAppInfo() : version=" + version.print () + " : update=" + update.print (); LMSDebug (msg); // ok return if ( callback != null ) { callback(true,version.print(true).Replace ("\"",""),update.print(true).Replace ("\"",""),"",download); } } } else { // probably an error, show it JSONObject p = decoder.GetField ("params"); JSONObject msg = p.GetField("msg"); if ( msg != null ) { UnityEngine.Debug.LogError("LMSIntegration.lmsAppInfo() : msg=" + msg.print ()); // bad return if ( callback != null ) callback(false,msg.print(),download.text,"none",download); } } DBResult = "ok"; } }
//$obj->action='ApplicationVersion'; //$obj->params=['app_id'=>'zoll','device'=>'ipad']; //$obj->authKey=''; //"{"action":"Curriculum_EnrollToContent","params":{"content_id":3645},"authKey":"qedr4rm7gddo5russ0hh0m9gd3"}" public void LMSAppInfo( string appID, string deviceID, LMSVersionUpdateCallback callback ) { StartCoroutine(lmsAppInfo(appID,deviceID,callback)); }