Xapi does not work in Android device but works on Unity editor

95 views Asked by At

I have an app that uses XAPI to send determined information to a database and display it, When I run the app in the Unity editor on the computer the XAPI communication works perfectly, but when I put the APK in my mobile it does not send the information and when several statements are tried the app freezes. I had implemented XAPI as in the video: https://www.youtube.com/watch?v=zX8Pq9STvoo and neither the computer or mobile are in the same network as the LRS. The credentials are correct as statements can be send with the editor. The send function is as follows:

void SendStatement_key(string verb_key , string actor_key, string definition_key)
{
    //Build out Actor details
    Agent actor = new Agent();
    actor.mbox = "mailto:"+ actor_key.Replace(" ", "")+"@learninglocker.net";
    actor.name = actor_key;

    //flag_4.change_bool_false();

    //Build out Verb details
    Verb verb = new Verb();
    verb.id = new Uri("http://www.example.com/" + verb_key);
    verb.display = new LanguageMap();
    verb.display.Add("en-US", verb_key);

    //Build out Activity details
    Activity activity = new Activity();
    activity.id = new Uri("http://www.example.com/" + definition_key.Replace(" ", "")).ToString();

    //Build out Activity Definition details
    ActivityDefinition activityDefinition = new ActivityDefinition();
    activityDefinition.description = new LanguageMap();
    activityDefinition.name = new LanguageMap();
    activityDefinition.name.Add("en-US", (definition_key));
    activity.definition = activityDefinition;

    Result result = new Result();
    Score score = new Score();

    score.raw = _value;
    result.score = score;

    //Build out full Statement details
    Statement statement = new Statement();
    statement.actor = actor;
    statement.verb = verb;
    statement.target = activity;
    statement.result = result;

    //Send the statement
    StatementLRSResponse lrsResponse = lrs.SaveStatement(statement);
    if (lrsResponse.success) //Success
    {
        Debug.Log("Save statement: " + lrsResponse.content.id);
    }
    else //Failure
    {
        Debug.Log("Statement Failed: " + lrsResponse.errMsg);
    }
}
0

There are 0 answers