+1 vote

HI,

I want to send some data from a mobile to my server (running on a PC). Testing the Godot app on the PC successfully sends the data to my webserver. However, running the same app from an Android mobile device does not work (no data received on the webserver). What's different about sending the data via a post http request from a mobile? how can I do this? Thank you!

Here's my code:

extends Node2D

onready var data = "testing ...."
onready var url  = "http://my_url:8001"

func _ready():
    var query = JSON.print(data)
    # Add 'Content-Type' header:
    var headers = ["Content-Type: application/json"]
    $HTTPRequest.request(url, headers, false, HTTPClient.METHOD_POST, query)
    pass
asked May 30, 2019 in Engine by marcorexo (85 points)

1 Answer

+3 votes
Best answer

you need to enable Internet permission at export setting.

answered May 30, 2019 by volzhs (9,462 points)
selected May 30, 2019 by marcorexo

Thanks volzhs!!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.