method to login using Datasnap

Asked

Viewed 517 times

1

I’m making 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 make a method to get users who are already registered in the database and then how to call this method in the application, so when the user opens the application on mobile he will login.

1 answer

0


You need to first create the methods of Datasnap for Android and put in your application, 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 the data:

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

This being the method created in the server-side Datasnap application generally declared in the file DServerMethods.pas of the application:

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.