B4J Tutorial [WebApp] Web Apps Overview

Status
Not open for further replies.

jcredk

Member
Licensed User
Longtime User
Hi all,
I am working on a project to make Android devices push messages to each other (not chaos, with a logic behind). This server apps seems a great starting point.
Let's assume that my ADSL box is having a DNS ("MyDNS"), and the raspberry pi having a fix local ip adress ("PiIP")

If I want to run the server of this tutorial, could you tell me how I should setup the ADSL port forwarding to "expose" the Pi to the web please ?

Thanks,
 

Roberto P.

Well-Known Member
Licensed User
Longtime User
I was able to install and run the sample. Is there a way to launch the server without displaying the console dos?
Or is there a way to launch the server as a service?




here's how to launch the application: "C: \ Program Files (x86) \ Java \ jre7 \ bin \ java" -jar MetaDataSyncServer.jar

thanks
 

iCAB

Well-Known Member
Licensed User
Longtime User
Hi Erel

I am trying to work with the examples attached:
ServerExampleNoMySQL.zip, gives me a compile error when I try to "Compile to library" (
Error description: Cannot access excluded module: main
Occurred on line: 15
resp.SendRedirect(req.FullRequestURI.Replace("http:", "https:") _
.Replace(Main.srvr.Port, Main.srvr.SslPort)))



Thank you
 
Last edited:

iCAB

Well-Known Member
Licensed User
Longtime User
Sorry my mistake ... not familiar with B4J properly ...I just wanted to create the .jar file and I didn't know that I need to compile in release mode.

1. Can you please let me know what is the name of the process that runs
2. Can we control the name process name
3. and what is the proper way to launch a process like this at startup..
4. also how do we terminate and restart the process

The reason for my questions above:
I downloaded "Process Explorer", and I tried to find out the name of the process by locating the process locking the .jar file after I launched from the command line. I terminated the process, but I still get address in use when I try to run the server from the B4J.

Please clarify



Thank you
 
Last edited:

iCAB

Well-Known Member
Licensed User
Longtime User
Hi Erel

After adding WSPushService to my app, I started getting "Unfortunately ProgramName has stopped" after terminating the app.
The issue is due to some uninitialized variables that are being access by the Service ( please note that there is no issue while the application is running as all these variables are initialized proper during run time )

I am not sure what I am doing wrong in here, but here is what I have done so far

B4X:
#Region  Service Attributes
    #StartAtBoot: false
    #StartCommandReturnValue: android.app.Service.START_STICKY
#End Region

B4X:
Sub Activity_Destroy
    Try
  
        StopService(WSPushService)
       Log(  "destroyed" )
      
    Catch
  
        Log(LastException)
      
    End Try
  
End Sub

I have also commented out: StartServiceAt in Service_Start

any advise is greatly appreciated
 

salim safran

Member
Licensed User
Longtime User
did any try to run such a b4j web application for example on raspberry pi in away configured as captive portal so when access as wifi spot will be directly forwarded to the bj4 web application without needing to worry about the ip address. the procedure is documented on the internet but will appreciate your input on this issue within b4j
 

Douglas Farias

Expert
Licensed User
Longtime User
@Erel when you have a time add option to login with face google or twitter on the login example pls?
 

yontala

Member
Licensed User
Longtime User
I am very confused. I 'm trying to do the example "HelloWorld" application from scratch but, when compiled in release mode I don't see the files "b4j_ws" and "index" . I understand that I have to make an HTML index, but in the example there are two index and "b4j_ws". Can some one help me?

 

DonManfred

Expert
Licensed User
Longtime User
to do the example "HelloWorld" application from scratch but
you started to use the wrong source and posting to the wrong thread?

If you are talking about the HelloWorld then i guess you should use the source in this thread instead if this here

With the right source you will see
E:\B4J\Projekte\WebAppHelloWorld\Objects\www (please note this is my path)




but in the example there are two index and "b4j_ws"
As you can see in my snapshot there are ONE html-file, ONE CSS-file and ONE b4j_ws.js javascript file

Please note that you should show the file extensions. It would make some things easier like now where you are irritated.
 

yontala

Member
Licensed User
Longtime User
Wow!
Thank you!
I finally understand . The problem is that my PC does not recognize these files.
I use windows 7.

I apologize , I saw the link of "HelloWorld" app at the beginning of this post.

 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…