How to use local REST API on smartphone? - android

The environment: There is a REST API written in PHP running on a computer in my local network. I want a smartphone app to use this REST API just as it was on a real server.
The problem: How can I do that? Anyway I have to establish a URL, reachable by my smartphone, pointing to my computer. It doesn't matter for me, if the URL is a "real registrated url" or a local url such as "example.dev".
The restrictions: I don't want to have my smartphone rooted and I have no static IP.
Does anyone have some advices for me? It would be really great to come over this.
My thoughts: I was thinking about a local dns server (e.g. on a raspberry pi). But I don't know if this works, because all the guides say, you already must have two domains registrated and already pointing to static IP adresses to the target system.
Thank you for your help and I hope, nobody else has already asked that.
Luke
UPDATE: I don't want to run it on a real server, because it's currently under development. Forgot to mention that. So I want to develop the whole system locally.

Related

Its possible to make a local webserver be worldwide vía Android Studio and a API of a third party? [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 13 days ago.
Improve this question
i need to broadcast a local Webserver to internet, i know of services like ngrok that can do that, but the big problem of that service is that needs to be executed in an external application. I was wondering if i can do something similar internally in Android Studio (With an API of a third party or something). To give you a context i made a webserver in Arduino, that have a local ip and i know that its possible to broadcast the information to internet with a "tunel" (that can be Ngrok), the thing is that i want to be able to configure EVERYTHING vía application, so im going to give via app the SSID and password of the WIFI using a bluetooth module, then the arduino is gonna create the web server, but this server is local and i need the server be global, thats why i thought that maybe there exists something similar to ngrok but for being used and configured by applicattions internally. So again, i dont want to use PC, or other application, just the APP or maybe do it in arduino itself. Thanks you so much in advance, feel free to share your thoughts.
When creating a server you can decide where you want to expose it. I recommend to take a look at What is the difference between 0.0.0.0, 127.0.0.1 and localhost?
Ngrok allows us to redirect a domain to a local element. Ngrox will only expose your webserver to internet if your webserver expose on localhost, if it expose on 0.0.0.0 and is properly configured (not firewall issue with the ports) you will be able to access it using your machine ip.
You can see this application Simple HTTP Server which seems to do what you are asking.
The only thing you have to do is going to the settings of your router and forward the used port to the ip of the local machine where your webserver is running on.
Thats all.

Get JSON data from local server (IP via service announcement?)

I'm trying to communicate with a local API server, but found out Android devices are not able to communicate with local domains. I've been up all night looking for ways, but came with nothing. I found the jmdns packages, but don't know how to include it in my cordova/ionic app. Currently i am trying a Cordova plugin (diont), but am a little lost ;-) Does anybody here know of good working sollutions?
I am building a device for use in a local network, so i have to figure this out :-)
Thanks!
Bad news, this is a well known Android bug/missing feature.
https://code.google.com/p/android/issues/detail?id=8030
If you really need to make this work, the only "solution" i can think of is to do a DNS lookup yourself, since you are using Cordova, you'll probably need to write a plugin to do that.

Capture App JSON Requests Android via Fiddler

Recently I tried to figure out where the application Meet Mobile's data was being pulled from. This is mostly out of curiosity as I noticed they have this free app for Android/iOS but nothing available from a computer which struck me as odd.
I set up fiddler on my computer with my phone using my computer as a proxy to access the internet, but when I do this Meet Mobile is not able to fetch data, even though I can use the browser to navigate the web without issue. I followed this guide to set up my proxy:
http://www.cantoni.org/2013/11/06/capture-android-web-traffic-fiddler
I have discovered that the main site the data is being pulled from is https://awmobile.active.com/, and I believe it is being pulled via port 443. However, I cannot figure out the correct syntax to query from this site (which I believe the application uses JSON).
Please let me know if there is a better way to go about capturing the web requests my application is sending off to its home base. This is mostly an exercise of curiosity, and I'm excited to see what potential answers there are.
Cheers!
I figured it out - I needed to install the Fiddler certificate on my Android phone for it to allow the connections. I followed the steps listed here:
http://www.cantoni.org/2013/11/06/capture-android-web-traffic-fiddler
Thank you for your help and time!

Share file from Android with PC and Verse versa via wifi Hotspot

Basically, what i need are reference materials or online tutorials on how to share files with my PC from my android files as it is done in WiFi file transfer pro. What are the android technologies i need to know to be able to implement something like that. This question might be a bit broad, but i am a beginner and i really want to know how to go about doing something like that as i am to implement something related in my mid-term work.
Consider two things: (1) how to connect the PC with android device over WiFi; (2) what protocols are used for file sharing.
There are multiple solutions for (1). You may connect both devices to the same WiFi router (requires an extra equipment). Or you may set one device as an AP and let the other connect to it. You may also use the ad hoc mode. Once get connected, ping the counterpart at both ends to make sure they get connected. All you need in this step are the IP addresses for both devices (PC and android device).
For (2), you may use either http or ftp. There are free http/ftp server on Android market that you can use directly. Once the server is done, access the server on you PC with IE and with the correct IP address/port number. You may also design your own server and client SW with customized UI and novel functions.
You can realize this solution with no programming jobs. Alternatively, if you want source codes, try the keywords http/ftp, server/client.
Besides this solution, you may also utilize the cloud service like Dropbox. Simply install Dropbox on both devices with the same account. They will see each other and synchronize files automatically. No programming job. Drawback is the need of Internet access at both ends.

Android: How AirDroid app does work?

Hello I am going to develop an app like "AirDroid" on Android Market which connect a device with the PC using wireless communication.
Can anybody explain to me how this app works?
Is Internet required for that or not? and from where that window which display the content of the device in PC, comming from to explore the Device?
Is it Internet required for that or any server manages that?
Thanks.
AirDroid is server application based on lightweight PAW Server: http://paw-android.fun2code.de/. I think that the used framework is your main question, isn't it?
Another server you might want to try is Jetty: http://code.google.com/p/i-jetty/
Have fun ;)
actually air droid starts a http server on your phone just like apache does on your computer. ALL THE graphic that you see you can actually retrive from the app itself it doesnt uses internet. You can extract that graphic from the app just by using a zip opener to open the .apk file. It mainly uses client side scripting for exmple javascript.

Categories

Resources