I've successfully build the AppRTC for native android by taking code from https://github.com/njovy/AppRTCDemo
and I'm able to make videocalls providing the address of the demo app ( https://apprtc.appspot.com/?r=XXXXXXXX ). Now I have install the nodejs
and also run the node static server in my system. I also know that to run the app on my local server we have remove Google TURN server. But how to bypass this turn server. I have also read this ApprtcDemo with local server works between browsers but not Android native to browser but can't able to understand clearly.
The problem is that what I need to make change in my code and how to install turn server for node server so that android can connect to my local server. How to manage the setup of turn server in Centos7 and what is apprtc.py
I am new to this and does not have much knowledge of server so if i have asked anything wrong so ignore it but please reply me.
After lots of effort i have install the turn server by following the link https://www.webrtc-experiment.com/docs/TURN-server-installation-guide.html
Now i have to change the url in my code but i can't able figure what and where to make change in Apprtc demo sample for native android
nodejs has nothing to do with TURN server, I believe you are using nodejs for signalling. If you do not want to use TURN server then you have to remove this url from iceServer configuration. For TURN server local setup, what TURN server you are trying to setup locally? May be you should find some free TURN serve binary along with setup documentation. But why don't you just try any TURN service available for free or as an evaluation?
[Edited] The purpose of TURN server is to facilitate connectivity when both end point are not able to connect using the local candidates where STUN server helps to identify the server-reflexive candidate and TURN is to allocate a Relay candidate. Just to understand your case, you want to run TURN/STUN server in your LAN setup? then there is no use of TURN I guess as TURN server itself is residing inside of the NAT. The general setup requirement of TURN server is have a public IP address which will be used as a Relay candidate for the end points. If you understand this case and still want to setup TURN inside of NAT then its not a harm but to remind you that you won't be able to use TURN when any end point is our of that LAN.
After lots of searching on google i have find out my solution from https://github.com/webrtc/apprtc link here you have to use google app engine along node js for making local server.
Related
I have a multi-tenant web app like
http://xxxxx.constant-domain.com:8080/
in my host file
127.0.0.1 xxxxx.constant-domain.com
The device that has the android app running is connected via ADB which calls my webapp's Rest Apis to get and send data and
It runs fine on dev and prod environments like
http://xxxxx.dev.constant-domain.com/get-data
but the problem is I want to debug it on my local server. I tried adding the given domain as base url but it doesn't work.
I tried adding http://localhost:8080/ as well but it doesn't work.
I tried looking for questions here but didn't find anything that would help.
I'm using retrofit for Api calls.
Any help would be appreciated.
First of all, make sure that your local server and your device are using a same wifi. And then find out the option to put your local server online. There is an option in Wamp Server to put it online. I don't know which software you are using to setup apache or any kind of server on your computer.
And then you will be able to access your local server by ip address. Also there is an option to edit virtual hosts of your server to allocate a specific port that the app can connect.
It doesn't matter whether you use Retrofit or Volley or Okhttp or any other things. You need to setup your local server to be online within your local network.
I figured it out. All I needed to do was to set my private Ip as
http://192.168.8.400:8080/get-data
Hope this helps anyone who is in this situation.
I have made a rest api with database for an Android app. I have made this in php in my localhost. Now I want to access it from my Android app. How can I access it through URL in internet. I am totally new to this, plz give me in details.
This question, brings back so much memories. You need to tunnel your local host packets to the public internet. There are many tools, but the main one i use is NgRok.
Details
Test mobile apps against a development backend running on your machine. Point ngrok at your local dev server and then configure your app to use the ngrok URL. It won't change, even when you change networks.
Don’t constantly redeploy your in-progress work to get feedback from clients. ngrok creates a secure public URL (https://yourapp.ngrok.io) to a local webserver on your machine. Iterate quickly with immediate feedback without interrupting flow.
A note of interest. if your app currently as a https signed certificate you might need to add some extra classes, if not you good to go. Read up here.
Guide lines for local public hosting.
Create your webserver(php,node.js etc) , start it, and verify on localhost:port
Start ngrok, its simple visit the website, the instructions are there
Ngrok will give you a url, that url is public anyone can access it, while your computer is powered on
On android side, use a http client, such as Volley, Http2 or Retrofit.
You have a few reading up to do
I am looking for an existing library to establish a connection between any smartphone(android/ios/win phone) and a web page.
Sort of what whatsapp is using (https://web.whatsapp.com/), with authentication.
Once the connection is established, i will have to send real time data ( audio and text) from the phone to the pc.
I suppose that whatsApp use a server to relay the data. i dont mind doing the authentication with the help of a server but once the connection is ok,I prefer to do all the communication on wifi instead of sending data from the phone to a server and sending it back to the web page on the pc.
Thanks!
When you want to solve a particular problem which is already solved, You don't want to reinvent the wheel(especially in web) but use the existing solution.
What you are looking for is WebRTC. Fits exactly for your use case. But i am not sure about the development efforts required for this.
There are Client libraries in almost all languages. A quick search gave this for Android
And i am not sure about the device support you are expecting, check Caniuse?
Also have a look at WiFi-p2p for android.
UPDATE:
check this webrtc website for cross platform development support and examples.
There is no real "best" way of doing this, but you have to have a server of some type running on your computer. From there you can use normal network requests from Android to communicate with your computer as long as they are on the same network (WiFi). https://developer.android.com/training/basics/network-ops/connecting.html
I am in need of some help here.
I want to make an Android application that eventually syncs to a web server in order to get information (i.e. user can write a note through the website, and it automatically syncs to the phone).
I am aware that I would need some web servers and hosting, and don't know too much about that so I will look into it later.
MY question, however, is how I can simulate this over a local network?
As in, if I create a basic webpage that has a two text boxes (one for name, one for content) and a 'submit' button, if I run it via localhost WHAT methods can I use to get this information to sync to my handset?
If anyone could be kind enough to give me a laymens terms breakdown it would be seriously appreciated, I feel so lost!
You have some alternatives to achieve what you want, here is a traditional one:
Start with installing XAMPP and run a local server
Write your web pages, store the data in mysql
Write PHP code to extract the data from mysql
Use Android HttpClient to call your PHP
There are other alternatives:
Use the same method but instead of PHP write HTML5 and you have a mobile WEB application
Check out the GCM Demo Application
Check out Google App Engine
Check out Amazon Web Services
There are others
Enjoy :)
Yaron
When you use localhost (meaning you install a server package such as Apache / IIS / XAMPP / WAMP in your computer), your machine becomes a server. So, you can access the localhost from any device which is in the same network.
Say you have a computer connected to a WiFi router. If you setup the server i.e. the localhost in that computer and a laptop and a mobile phone is connected to the same WiFi router, the phone and laptop will be able to get service from the computer.
To access data stored in the MySQL server from the other devices (e.g. the phone), you have to write proper service. Else, you can write a mobile web app in the server that accesses the MySQL data and just access it from the device.
I am working on a nfc project in which there is a need of client-server model.
The Actual scenario is, when my Tag is tapped, the data in tag should proceed to the server and server then looks-up in database for that particular key data in tag and sends related information back to my android phone as a response.
I have Apache Tomcat, Eclipse Helios and Eclipse Indigo, currently I'm thinking of get it done using servlet? But little confused as I am totally new to this scenario. Kindly guide me.
Thanks in advanced.
If I were you, I'd let my phone connect to the wireless router, then setup Apache on my computer and allow the phone to pull pages from Apache server. As long as you are testing there's no big deal which software to use on the server, Tomcat or not, you may easily get away with PHP, CGI or even simple static text pages.
After you setup Apache, use ifconfig or ipconfig to find out the IP address and then let your phone to access http://IP_address_you've_just_found/, this should get you going.