method to log in using DataSnap

1

I'm doing an Android application using Delphi, I have a server with the methods to get the data from the Mysql database, I would like to know how I can do a method to get the users that are already registered in the database and then how call this method in the application, so when the user opens the application on the mobile phone it will log in.

    
asked by anonymous 17.02.2016 / 14:29

1 answer

0

You must first create the methods of Datasnap for Android and put in your application, for example:

C:\Win32ProxyDownloader.exe -language java_android -host 127.0.0.1:8080 -output C:\test

Then you create a class with a Datasnap connection to connect to the server:

DSRESTConnection conn = new DSRESTConnection();
conn.setHost("host");
conn.setPort(port);
conn.setProtocol("http");

And to recover data:

TServerMethods1 proxy = new TServerMethods1(conn);
VarParamTestReturns Result = proxy.VarParamTest("Hello, World!");
System.out.println(Result.Value);
System.out.println(Result.returnValue);

This is the method created in the server-side DataSnap application that is usually declared in the application DServerMethods.pas file:

function TServerMethods1.VarParamTest(var Value: string): string;
begin
  Value := StrUtils.ReverseString(Value);
  Result := Value;
end;

References:

Developing DataSnap Applications

Getting Started with Java Android DataSnap Mobile Connector

    
17.02.2016 / 14:40