B4A Library UltimateServersControl

Ultimate Servers is an App which "holds" a heavy lot of servers you can run on your device. FTP, IRC, HTTP/PHP, MySQL and so on and so forth
The Pro-Version is actually 50% off and available on Play Store too.

With this Library you are able to Start or Stop any Server in Ultimate Servers from within your own app.

Please note that this is my VERY FIRST Java-Library written with Eclipse and compiled with Simple Library Compiler.

UltimateServersControl
Author:
DonManfred
Version: 0.25

  • UltimateServersControl
    Events:
    • Response (data_type As String, server_iniqueid as String As )
    Methods:
    • Initialize (Eventname As String, UseUltimateServersPro As Boolean)
      Initializes the object.
      Use Eventname to tell which Event is to be called
      Set UseUltimateServersPro to true if you are using
      Ultimate Servers PRO. Otherwise set it to false
    • Register
      Registers the BroadcastReceiver.
      Used to get the response returned from Ultimate Servers
      Be sure to call unRegister once done. i.e. in Activity_Pause
      Be sure to call Register in Activity_resume
    • Unregister
      Call to unregister the BroadcaseReceiver once you are done.
    • isRegistered As Boolean
      Returns whether the BroadcastReceiver is registered (true) or not (false)
    • restartserver (serveruniqueid As String)
      ReStart the server with the unique ID serveruniqueid
    • sendlog (serveruniqueid As String)
      Sends the log if set in Ultimate Servers Options
      and clears the log after sending out the email
    • startallservers (serveruniqueid As String)
      Start all not yet started servers
      I am not sure if the unique ID
      serveruniqueid can be empty here
    • startserver (serveruniqueid As String)
      Start the server with the unique ID serveruniqueid
    • stopallservers (serveruniqueid As String)
      Stops ALL running servers
      I am not sure if the unique ID
      serveruniqueid can be empty here
    • stopserver (serveruniqueid As String)
      Stop the server with the unique ID serveruniqueid
    • switchserver (serveruniqueid As String)
      Switch the server with the unique ID serveruniqueid
      If is was offline the it will be started. If it was
      online then it will be stopped
 

Attachments

  • UltimateServersControl.zip
    3.8 KB · Views: 371

DonManfred

Expert
Licensed User
Longtime User
A small example of using this Library

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim usctrl As UltimateServersControl
    Dim ftpID As String =  "BSEU4D8SJD2G3KO"  ' You must know the unique id of the server in Ultimate Servers.
    ' Click on a server and use INFORMATION in the popup to get this ID.
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("main")
    usctrl.Initialize("US",True)
End Sub

Sub Activity_Resume
    usctrl.Register
End Sub

Sub Activity_Pause (UserClosed As Boolean)
    usctrl.Unregister
End Sub

Sub ToggleFTP_CheckedChange(Checked As Boolean)
    Log("ToggleFTP_CheckedChange("&Checked&")")
    If Checked Then
        usctrl.startserver(ftpID)
    Else
        usctrl.stopserver(ftpID)
    End If
End Sub

Sub US_Response(data_type As String, server_iniqueid As String)
    Log("US_Response("&data_type&","&server_iniqueid&")")
End Sub
 

Attachments

  • usControlDEMO.zip
    7.6 KB · Views: 328
Top