create local server on android - php

I want a develop a web application with php, and I want a run my apps with a android device. But my device will not be connected to internet, so I must create a local server on the device to run my php code. Is it possible? And if it's possible how?

Based on this page, developing Web Server for mobile devices is still on the research phase. Most probably you would need to use some kind of simulator for Android and develop your App on powerful desktop PC.
EDIT: Looks like such a server exists for Android.

Please use KSWEB.apk. This app supports PHP, SQL, html, csc, but it requires 3 android devices. The first serves as router, the 2nd device is a local server and the 3rd devices is a monitor.

I'm not sure about your need to have a web server running on your phone, but if you have a wireless router and your phone can connect to it, can you not install an Apache server with PHP support on your development PC and access it via your phone's wireless connection?

Related

is there any commercial apache server available other than xampp and wamp

I am developing a tablet based android application and its back-end and api calls are done in php (slim lib) and mysql.
the app architecture is bellow.
there will be a local server machine in the building / room for handling api calls from android app through wifi network. all the data and media files uploaded /stored in the local machine. android app fetches the data/media files form server on demand via api calls.
Now am using xampp server for my test purpose and its work decently up to 10 devices . if the number of devices increases some devices lost the response from server or wait long time for response especially in file downloading from server to tab.
I have tested the app with real devices and commercial router. I need to improve the response speed from server and fast simultaneous file downloading.
Is there any commercial local apache server package available other than xampp and wampp.
Use EasyPHP. It is is one of the best contenders to Xampp.
Laragon
Easy Php
There are others, check out:
http://alternativeto.net

Web Service betweet two machines run on local

I'm working an a Web/Mobile Application.
Desktop is made with Laravel 5.1 and Oracle 11g express Edition.
Mobile is made on Android.
I'm using two computers, both of them are on local (Android and PHP).
All works fine on the desktop application.
Now it's time to connect my Android App to the database, to do so, i have to implement a Web Service.
How can i get the URL of the web service and use it on the other machine for android?
How can i test my webservice ?
For trying Web Service locally,
Both your device needs to be in the same network.
The API calls will be like: <YOUR.IP.ADDRS>/PATH in you Android App Source Code.
You can even use Postman REST Client, to test your app.
See, if that helps.

android database with just sqlite

I am new at android.
I have some problems with android database and how to deploy it into a server without develop a web site for the application.
I want to publish this app into google play after a while.
so an online web server is needed.
Locally woking is useless for me.
So my questions are:
1) If and only if with using sqlite database, can i deploy my application into a server to make it accessible ?
2) if sqlite is not sufficient for me , then how can use php & mySQl ? and could you please offer me some a kind of hosting services for android applications?
3) I want to manage sending notifications from the server and provide communications between devices. Is there any service to provide my needs ?
Thank you so much.
No you can't...You need to have separate database(sql server/mysql) for your server. And then write some webservice so that you mobile app can communicate with server database.
SqLite is only for mobile device and no server supports it, APIK.

Testing PHP Web Service locally by using android app

I am new to web services and planning to design a php webservice for my android app on my local machine which will send some user informations to database and generate some JSON data. But the problem is i am little confused about how to test it.
For example lets say that my webservice will locate on my local machine like below http://localhost:80/webservice/register.php
And my ip address is 192.168.1.X
Than is it possible for my android app to use this web service by using this url http://192.168.1.X:80/webservice/register.php
Normally since webservices are on the internet any program can access them. But i thought that i can test my webservice with my android app since both my pc and android device are on the same subnet.
If someone make things clear and tell me a way for testing a web service locally i appreciated
This is possible to call the web service in the local network also from the android app. But Your device and Your server on which Web Service running must have on the same network and Your firewall or any proxy server must be off on the server.

Making the web server as a relay between two sides

I want to control a robot from the web, the robot is connected to Android device. The operation will be as the following :
a web application written using JavaScript and HTML runs on desktop computer which takes the keyboard input from the user and send them to the android device connected to the robot.
the android device receive the commands and then send them to Arduino board which used to control the robot.
But how should I deliver the data to the Android device which doesn't has a static IP address?
I have two approaches to solve that :
the JavaScript application sends the keyboard input to a web server runs PHP and MySQL , then the php application store the data on the MySQL database. An application runs on Android connected to that web server and extract the data from the MySQL database.
the JavaScript sends the data to the web server. The android application connected to the web server receives the data directly so the web server is just used as a relay.
The first approach is easy to do but its slow , so my question is...
How to implement the second approach and which web technologies should I use to implement it? And how to make the web server works as relay between two sides?
PS : I am planning to use 000webhost.com as web server. so I will not use my own server
You can either have your Android application poll the webserver for outstanding commands. This is a little inefficient in terms of data usage, but if you're on an unlimited 3G plan / wi-fi, you could live with it. It will be very easy to implement.
Alternatively, set up a TCP server on your server, and have your Android application open a socket connection with the server. This way, your web application can send commands to the server which will immediately stream them to the Android device. It will be slightly harder to implement, but will be more efficient and robust if done right.
PS - Most shared servers don't allow you to open a TCP server on your host so you might be forced to go with the first option.
PPS - I wasn't aware of Google Cloud Messaging. It seems to be a good solution for you what you're attempting to achieve. You should have a look into it.

Categories