Communicating with PHP from an android app without internet? - javascript

I have made a web page and i am running it on a local host using the xampp server. In this web page I have a canvas that draws a line between two point. I read these points from a locally available csv file that I have generated. I would like to make an android application, where there is a provision to enter two numbers. I want this android application to make a csv file and save it on my computer so that I can access this file using my javascript.
Note: can I pass these values via an usb connected between the mobile and computer so that I can make a csv file locally in my computer? I want all of this to happen without the requirement of internet connection.
PS: I am newbie to android. If the above is possible, then please brief on how to approach this problem.

If you have a XAMP server all you need to do is connect the android device to the same network/router. There you can talk via HTTP methods to the apache server. You will just need to provide the ip address to the android app.
In the router you can set a static ip address for the mac address of your computer, so every time it connects to the router it always get the same IP and you dont need to input it again on the android app.

Related

How can I change environment for the tablet device?

I have a webservice app, and this is connected to an android device to create "inspections". Once you have created it, there are options to "synchronize", which allows you to upload this inspections to the webservice through a REST service. The problem is that I have a different environment and I want the android device to work on my local environment (development) and not in previous environment as actually.
I have the device connected with localhost using "chrome://inspect/#devices" tool. Also, I have changed the "baseUrl" in app-config file. Now, the main problem is that I can't login on the device app, but the localhost on browser works.
Any suggestion? Thanks.

Get userID of current windows user in my website via JavaScript

I have a feature in my upcoming web project where I will have to get the UserID/Email ID of the user currently logged in to the machine/PC. Target OS is Windows 10 and logins to the machines are done via Smart Card only. User Data is stored inside MS-AD.
This UserID will be used passed further for Authorization and load the app in browser. The target browser is IE and Chrome.
Is there a way i can fetch the EmailID/UserID of the User logged in via Smart Card to system in Javascript?
ADDITIONAL INFO: The website is setup in private environment. There is no public URL to access the webapp from outside Intranet. The client and backend code is hosted inside VM in Cloud. In nutshell, the is all sitting in private environment in Azure.
Thanks!
Not with JavaScript. JavaScript is run inside the browser container, and more specifically run inside your current webview. Letting JavaScript get access to settings and data on the local machine be a nightmare if phishing, malware and virus sites.
If you know which computers will run your website you could create an application with a server that's running idle on the machine, much like how Spotify's client is doing (the windows client can take commands from the webpage).
The application/server could then try to get the EmailID/UserID from the computer, and then having the server running on some specific port, your JavaScript could then use AJAX-requests to communicate with the local machine from the browser.
I could get the Windows Logged in user using the ActiveX script in IE.
var WinNetwork = new ActiveXObject("WScript.Network");
alert(WinNetwork.UserName)
Will this be a good approach to solve this issue?

Can an Electron/NW.js application be served in a browser?

Given an Electron or NW.js application, is there a way to run it on a remote server, and then access the application via a browser?
As an example, let's say I have stored a number of photos on a remote server. Now I would like to view the photos in a photo viewing app written with Electron/NW.js. Is there a way to launch the app on the server side, so that on my laptop I can just go to http://server-ip:some-port and use the app in the browser?
it's about running an Electron app on a remote server, and accessing the Electron app on another computer using a standard browser.
Electron / nw.js is nothing related to what you trying to achieve. Electron is framework allows to compose desktop application via javascript, and it is working as pretty much any other desktop application. If you'd like to access an application via browser on the remote server, that's territory for web page / application.

C# / JavaScript local code in hosted web apps on Windows 10

We have a fully functional website. Now we want to develop a windows 10 app and since hosted web apps seem the quickest way we want to explore that option. I have created hosted web app for our site but can I embed any local code in the app that can communicate with code website. Like can I change the user agent string to recognize request is from hosted web app? Can I access camera from local code? I was unable to find any resources on these. Or do I have to use a webview in UWP app and load website in it? Any suggestions?
Check this page first. If your url is defined within the app’s bounds(ACURs), then you can call windows runtime api which can help you acess to camera. But I didn't find any windows runtime API which can help you change your user agent.

How to open an HTML project on the iPad

I have an HTML project (CSS/JS/jQuery) that I'd like to test on an iPad (in Safari). From what I've read, iOS browsers don't support the file:///path/to/project protocol, and even if it did, I don't believe that you'd be able to navigate the file system to where your project is located.
Please correct me on any of this information if I'm wrong, I'm an Android guy so much of this is new to me. Nonetheless, I tried to use an app called Fileapp to solve my problem. I was able to access and load my project, but it was within Fileapp's native browser, and not Safari (unless it actually WAS Safari and it was just masked).
Does anybody know of a solution to my problem (preferably free)?
2016 UPDATE:
There are several services which now make this easy. If you don't have your own web server check out one of these free services which make updating a live webpage from your PC easy:
Heroku
Git Pages
Both of these services require using git, learn it, you won't regret it.
Days of FTPing or using Dropbox to serve html to an iPad are long gone.
If you need to be able to do this while not connected to the internet check out this article on using local IP tunneling. This would essentially open up the localhost on your PC to be viewed by anyone on a wifi network, regardless of if the wifi was actually connected to the Internet.
http://wesbos.com/localhost-mobile-device-testing/
I prefer Heroku as I am more likely to be switching between locations and PC's than I am to be on a wifi network without an Internet connection.
OLD ANSWER 2012
Get a Dropbox account and put the project in your public folder.
Right click to get the public link and then browse to that location on your iPad.
When I get link from the iPad app it doesn't work it just shows the raw html with a URL structure like so
dropbox.com/s/...
When I go to the website and copy public link (only available if the file is in PUBLIC FOLDER) I get the link that actually works.
Apache probably isn't the most convenient webserver to use for this kind of ad-hoc serving of a local project. Instead, if you're on Mac or on a Linux distribution that has Python installed (which is most of them), you can launch a webserver to serve your current working directory at the terminal with a one-liner:
python -m SimpleHTTPServer
By default it will serve on port 8000; you can specify another port by passing it as a final argument to the command.
To connect to this server from another device, like your iPad or phone, first of all you'll need to make sure your phone is connected to the same local network as your Mac or Linux PC. Then, on the computer, run
ifconfig
and look through the output for your local IP address, which will be labelled as inet addr in the output and listed under one of the connections other than "Local Loopback". On my current PC, I see inet addr:192.168.0.3 listed under the wlan0 connection.
Now, on your phone, open your browser of choice and navigate to the IP address you got from ifconfig on whatever port SimpleHTTPServer is serving on. For example, http://192.168.0.3:8000. You'll be presented with a directory listing corresponding to the directory in which you launched the server, and from there you can view whatever files you're interested in.
The answer to your question is that even with iPadOS the iPad is not a replacement for a Windows, Linux, or Mac. Still too many “can’t get there from here” cases.
One solution to the problem, as pointed out by minitech in the comments of the original questions, was to set up an apache server on my local network and connect directly to it. This worked exactly as I needed it to.

Categories

Resources