How to connect to the hosting database from Android?

Welcome.
Develop mobile application on Xamarin.Forms, which provides the connection to the hosting database.
When you test the code on Windows UWP no error is detected, the program connects to the database, sends the request and gets the correct result.
However, when testing the same when in Android (actually on the connected phone) to connect to the database fails.
The Android project separately connected MySQL.Data
Can you please tell me where I'm wrong.

code for dB connection:

string MyConString = "SERVER=tut ssilka.com;" +
"DATABASE=nameDB;" +
"UID=ID;" +
"Pwd=TutParol;";
var MyConnection = new MySqlConnection(MyConString);
try
{
MyConnection.Open();
label2.Text = "Connected";
}
catch(Exception e)
{
label2.Text = "no Connection";
}
April 19th 20 at 12:12
3 answers
April 19th 20 at 12:14
Solution
Right not to connect from Android to the database on the hosting.
April 19th 20 at 12:16
Solution
How to eat in the default constructor of the application. Create a new project and check the box to generate the backend.

In summary then.

1. Back connects to the database and prepares the data, giving only json, simultaneously making a bunch of tasks
2. The service in your mobile app makes requests
3. ViewModel provides data for display contains commands for interaction, caches data that would once again not to pull 2.
4. View just renders the ViewModel displays the dialogs, progress bars and everything else that relates to the UI.
April 19th 20 at 12:18
Solution
The issue has been resolved In the main project instead of MySql.Data used MySqlConnector Tested on the droid - the result is satisfied.
I understand that to connect directly from the app to the database, to put it mildly, boldly, but this topic is bachelor so that is acceptable.
Thank you for your assistance.

Find more questions by tags XamarinC#AndroidMySQL