Use AppRTC with a custom server - android

I've successfully build the AppRTC for android and I'm able to make videocalls providing the address of the demo app ( https://apprtc.appspot.com/?r=XXXXXXXX )
My question is, how can I make this app work with a custom WebRTC server OR with another WebRTC app ( e.g. https://talky.io/)
I'm a little bit confused about how to achieve this.
I've also followed the tutorials HERE and I'm able to make calls between desktop browser but I have no idea how to connect from the android app.
P.S.
If someone is interested I've built the app following the following links:
WebRTC : ninja build not working (see the comments)
http://simonguest.com/2013/08/06/building-a-webrtc-client-for-android/

You can achieve webrtc with your own server.
Several steps to follow:
1.Build your own HTTP server to provide the html service(i.e. the main page of your webRTC project instead of apprtc main page). In this step I use node.js and node-static(https://github.com/cloudhead/node-static).
2.Build your own signalling server. PeerJS is a good choice. Read the doc files. Also, code you HTML file to support peerjs.
Here is an example of peerjs implementation. It helped me a lot
https://developer.mozilla.org/en-US/demos/detail/peerjs
Goodluck!

Actually you can deploy web version of https://apprtc.appspot.com/ to your own server.
It's written on GAE (Google App Engine) - http://webrtc.googlecode.com/svn/trunk/samples/js/apprtc/
This has been moved to branches folder http://webrtc.googlecode.com/svn/branches/3.53/samples/js/apprtc/
Just register GAE account https://appengine.google.com/ and deploy this web app to it.
Next - you can connect WebRTC Android sample to you own GAE server - https://code.google.com/p/webrtc/source/browse/trunk/talk/examples/android/src/org/appspot/apprtc/AppRTCDemoActivity.java
Find line
roomInput.setText("https://apprtc.appspot.com/?r=");
and replace apprtc server name

Related

Running python script on Android local server

I need to build a chatbot which does not takes any online support.
I am using:
Python chatterbot to build conversation dialogues.
Android's google offline speech recognition to convert speech to text and vice versa.
I want to train the model on my PC and use the generated database.sqlite3 file on android.
The complete flow of the process is as follows:
Pretrained model generated database.sqlite3 which is placed in android.
Voice -> Text -> Local Android Server which runs python script using database.sqlite3 and generates response(text) -> Text to Voice
Now I have the problem of running Python on Android with all the environment needed to run the script on android. Kindly help me out with this.
I have searched stuffs and found setting local server on android using NanoHTTPD/AndroidSync. Now I want to use this server to run python script
If you have any better alternative to any of the steps above, kindly suggest.
In my experience, trying to get Python running on Android doesn't sound like the best way to accomplish this. I'd recommend splitting your project up into two parts:
1. A web application hosted somewhere
You can create a regular web application using a Python framework like Django or Flask. This application can provide a RESTful API that allows other applications to exchange information with your chat bot.
ChatterBot has built-in support for Django and there are numerous examples of the two being used together available. You can also take a look at the "How do I deploy my chat bot to the web?" section for a brief overview and some tips on how to get started.
2. The Android app
The app can access Android's native speech recognition technologies to interpret verbal information before it sends the recognized text to your chat bot API server.

How to create Android Web UI - remote app management

I have an application that runs on Android phone. I would like to add web ui like let's say torrent applications. I would like to manage my application from browser using my laptop, or another phone located on a different side of the planet ;)
What is the easiest way to run a web server inside app, and host a management web app? Is it possible to run nodejs/php server inside application and communicate with hosted web app?
Should be possible, because ttorrent and x-plore have such feature.
Thanks for any clues and advices.
I did several in-app web server projects. nanohttpd and golang are used in my projects.
Nanohttpd is wrote in pure Android SDK compatible Java. You can call any Android SDK API, with no need of RPC or language binding. But nanohttpd has little supports to develop web API. It's not a good choice if you have lots of APIs between javascript and the in-app server, but good if you need invoke Android SDK APIs in the in-app server.
golang supports Android(ARM Linux) well. The good parts are:
static link. you just need coding and build, everything will in one shared library file, you can ease use the library in your Android project
powerful APIs in standard library to develop a web server and web client. Great performance because of golang's async I/O and thread model
gomobile provide a tool to generate RPC wrapper for golang-java inter-operation. golang-c(jni)-java wrapper will also work but I not found a tool to generate the binding, writing bindings is boring.

WebRTC using Peerjs with Native Android/iOS clients

We're trying to build an internal system which will provide us with simple chat/video features using WebRTC. We have successfully deployed Peer.js client and server which works great over the browser.
However, we can't seem to find a fairly simple Android/iOS client/SDK to make it compatible with our PeerJS server.
We've tried looking into AppRTC and got the Android client running with their server, however we can't understand how to connect it to our PeerJS server since that Android client (and server implementation) seems really complicated (we're not JAVA experts).
I've also looked into EasyRTC, however it seems that they've pulled back their native SDKs, but the technology stack looks really close to ours.
My question is, has anyone got and Android/iOS Client working with WebRTC running on a NodeJS server? What are the possible workarounds to get this up and running natively on Android?
We're looking for a fairly simple Android SDK (links to libraries/sample projects) which could work with a PeerJS server.
Edit: We could build a signaling server (on NodeJS) ourselves, but how can we build the Android/iOS clients from then on?
I'm offering a bounty of 200 rep to whoever can answer our questions.
I don't know PeerJS but it seems like using websockets. If that's the case you have to implement WebSocket client functionality in you native clients (and various PeerJS internal connection/signaling protocol).
For native to native signaling, it's really simple because we only have to exchange SDP and ICE candidate messages between clients (via WebSocket or any other messaging mechanisms).
To connect to PeerJS server, obviously, we need PeerJS client implemented in Java or C(ObjC).
I'll be surprised if such implementation or SDK exists.
I don't know current state of AppRTC source, but in its old version, it hosted a WebView to run a kind of HTML+JavaScript signaling client.
That is, you can host a WebView and reuse your PeerJS client in Android/iOS apps.
You can have look at Crosswalk project. By follow Tutorial: porting Android app from Web App for WebRTC using PeerJS library. I have done it and it worked perfectly.
There are another option which is using http://phonegap.com/ to port from web app to Android/iOS but I could not make it work event just with "getUserMedia" API.
Hope this help
I found a example in here https://github.com/pchab/AndroidRTC1
On the server they used nodejs + socket.io + AngurlarJs.
On the client they used libjingle_peerconnection + socket.io Client.

phonegap development environment

I'm trying to get setup to do mobile development using phonegap so i can deploy my application in android store and apple store. It's my understanding that I can simply wrap my application in phonegap so I can deploy for Android, iOs, BB, etc.
My application is an ASP.Net MVC app written with VisualStudio. All of the examples I've read through in my research tells you to use Eclipse for PhoneGap and Android, use XCode for PhoneGap and iOs. My app is ASP.Net MVC that produces Html 5. Is it possible to use PhoneGap with VisualStudio to produce Android and iOS deployable phonegap apps?
One alternative I've been thinking about is creating a simple Index.html page that uses jQuery to make a call to my ASP.Net MVC app and load the resulting HTML inside a div. Then I can simply reproduce this very lightweight Index page in Eclispe, XCOde, etc to run through Phonegap. This seems like a hack though. I've tried getting this to work but have not had any luck in the Android emulator in my windows environment.
Can someone please point me in the right direction for how to incorporate PhoneGap with my ASP.Net MVC app? Thanks.
ASP.NET lives on your server, so anytime you reference any ASP.NET script, you'll have to make the URL an absolute one with a hostname: http://www.example.com/my-script.aspx. Any non-dynamic files should be stored locally on the device so they will function when there is no network connection. You can then just host the dynamic files on your server and reference them whenever you need to. To keep data transfer size as small as possible, I generally pass JSON or something similar to the app. from my server-side script and then interpret the data into HTML in the JavaScript code for the app.
You should keep as many assets as you can local on the device so it doesn't require an internet connection to use the app. So don't link to a remote version of jQuery, save it as a part of the app. package you create so it's always available.
Eclipse/Xcode are nice because they help you create your app. and package it properly for submission to app. stores. They are also nice because of how easy it is to find help using Eclipse or Xcode to create apps. Xcode is actually required, Apple makes sure you have bought the latest hardware and the latest software just to be able to submit an app. to the store.

WebSockets for Android in Phonegap application with Node.js/Socket.IO server&client

I am making an Android application in PhoneGap. What I'm trying to do is let the application talk to my Node.js server through WebSockets. My Node.js server uses Socket.IO which automatically falls back to polling when I open the application up, in contrary to the desktop Chrome application which happily opens up a WebSocket and communicates through it just fine.
I've read this blogpost about integrating the actual WebSocket API with Phonegap. The problem there is that I'm not overriding 'onConnect, onMessage' functions manually, instead Socket.IO does all that for me.
Is there some way to integrate WebSockets into my Android Phonegap application?
Short answer: Cordova WebView doesn't support WebSockets and socket.io doesn't connect to standards-based WebSocket clients.
For your client, it still appears that if you want real websockets, you need to use a Cordova plugin that is specific to an Android build or an iOS build. Try this search, which includes anismiles repo for an Android plugin, the same blogger referenced by the OP.
So with that in mind, socket.io will not work for your server. Unfortunately, socket.io server does not support connecting to clients with an Html5 standards-based websocket connection, you have to use their client library. As you've seen, you can't use their client library in Cordova...well you can, it'll just fallback to polling.
So now your websocket client is a standards-based Cordova plugin, you need a server that supports a standards-based websocket connection. You should take a look at SockJs, Worlize, Miksago, or Einaros. There are others. I'm currently using Worlize.
Another thing to keep in mind is that there is a short list of cloud hosts currently supporting true websocket connections. I recommend DotCloud or Nodejitsu.
If this answers your question please click the check mark :)
Updating the answers, this plugin works with socket.io and it's much easier to use (PhoneGap 3.x only).
https://github.com/mkuklis/phonegap-websocket
This repository will be integrated in phonegap very soon (at least it sounds like that in the readme)
It also also provides the steps for making web sockets work in phonegap / android.
Take a look: https://github.com/anismiles/websocket-android-phonegap
Here is another websockets Android client, that I am currently evaluating.
http://jwebsocket.org/mobile/android/android_part1.htm
I'm afraid I have no idea if it will be useful to a phonegap project, not being familiar with it.
Phonegap would need to allow you to incorporate an external java library into your project and you would need to build an interface for it in java.

Categories

Resources