Is there a way to set up a kafka server on Android? - android

My goal is to feed a NN on Android with real time streaming events from various data sources (sensors, other servers). I have created a working set up on a linux server with Kafka to explore the concept. Replicating this set up to an Android device poses the question if this is the correct architecture for a mobile device as well, or if I should go for a completely different approach.

Kafka on Android does not work (server especially, but client neither), and is not recommended due to required network connections.
More commonly, MQTT is used for streaming mobile and IOT sensor devices (which could in-turn send data to Kafka at the backend, collection site)

Related

best way to connect android app with desktop app?

I want to develop a system in which data is being shared between DESKTOP app and Android app.
After searching I have found that I need a server in between them. But I can't figure out what the server is? How do I create it? And how will it help me connect my two platform devices?
Desktop App will receive data from android app. And manage data. It will also be used to send notifications/messages to android apps.
Android App will be used to input data and send it to desktop app. It will receive updates/notifications from desktop app.
Now how do I connect these two? I basically need a common database for real-time data sharing and notifications.
Edit: I am building the desktop app using C# and android app using Java.
Edit2: Maybe I can host the database on CPANEL or 000webhost using PHP. And then connect it with both android and C#. Is this the correct way to do it? Is it possible to connect it with C#? I know it can be connected with Android, not sure about C#.
You don't necessarily need a database. You need a common network protocol between two applications.
All network communication is done via sockets. You need a library that allows you send data over sockets. For example, here's an Android guide that is about sockets.
A socket binds to a specific port of a computer, essentially making it a "server". Much like how web servers all expose port 80, and communicate over a protocol called HTTP. Which is important because it is up to you to decide what protocol your applications communicate between each other, because the socket just sends bytes - it doesn't care what you send or how, as long as it travels to a port on a particular server. It also won't parse the data for you, that's up to your application to handle. For example, how would your desktop app know the Android device sent it a text message, or some image to be displayed, or an address to show a map?
All in all, your reason for wanting a desktop application rather than a web application is not entirely clear. Parsing only the body of HTTP payloads from different HTTP paths that are mapped to different methods (which is typically referred to as a REST API) is much simpler than building your own protocol. You might as well build a desktop GUI over top of a web server.
Making the desktop app send updates back to your mobile application is basically impossible using a bi-directional socket architecture. Your Android should not be running an open server socket continuously just for your application, mostly because battery drain, but because its network address is subject to change frequently, and you therefore additionally need a registration server from which your device would reconnect to. Such a service exists as Firebase Cloud Messaging, which is a rebranding of the GCM technology made by Google, and it can be used to send push notifications to devices, but only with small data payloads.
See here about what activities occur on an Android device for notifications. How does push notification technology work on Android?
Back to the question about databases. Suggesting one to use is too broad. And you only need one of those if you want to store and/or query or join datasets. The same computer running the desktop app can install and run whatever flavor of database you prefer, whether it's a relational database or noSQL database, entirely up to you. The only realtime databases I know of are RethinkDB and Firebase.
You could also just hold a SQLite file which is as good as a small scale database (even the SQLite documentation recommends it for low traffic web sites).
Firebase supports web interface, so you can develop html code and integrate in desktop app, something like web integration in windows form application

How to monitor Android network performance?

We want to do network performance monitoring by monitoring the api calls. Currently we are using Android Network monitoring which is integrated with Android Studio.
There are some problem with this framework. It can only give the amount of data transfer and receive. It doesn't give the number of api call. This metrics is really necessary to determine if there is unnecessary api call. Otherwise it would be hard to determine.
It is integrated with the Android Studio and we can't use it in the test framework because it just gives the graph which is also hard to compare the result.
I want to know if there is any framework available which can be used to get different metrics of Network performance.
Hey there is a library for this provided by Facebook. Please check:
network-connection-class [facebook-code-site] [github link]
A solution that can help you is Ixia's IxChariot.
IxChariot is a versatile product that is used for testing network peformance in various scenarios.
In your case, you can install the IxChariot endpoint on an Android device (download it from Google Play) and use the endpoint to generate traffic to and from the device and measure its network performance, in a lab environment.
Additionally, you have to install a second endpoint on the IxChariot server hosted in a cloud or public network.
Both endpoints must be configured to connect to the Registration Server located on the same machine as the IxChariot server. Once this configuration is complete, you can use the web interface to run various tests on the mobile data connection.
The range of available tests includes TCP, UDP, RTP, and VoIP traffic, with unlimited or configurable data rates. The reported statistics include Throughput, One-Way Delay, Jitter, Loss Rate, and MOS Score. IxChariot is capable of sending bidirectional test traffic, thus testing both the inbound and outbound directions of the mobile data connection.
Full disclosure - I work as Sr. Marketing Engineer at Ixia.

Mobile live synchronization (eg Trello): sockets?

I was wondering how live synchronization mechanisms such as the one used by Trello work.
For example when I move a card from the website, the board is immediately refreshed on the iPhone too. As Push Notifications are not reliable, I suppose a sort of open connection/socket stream is used under the hood.
socket.io quotes Trello among its users: does anyone have any reference about Trello's mobile implementation?
Thanks,
DAN
Trello uses a combination of WebSockets and polling to perform instant updates. Most clients use WebSockets all the time; the few that don't support WebSockets use short HTTP polling instead. It also uses a single HTTP poll to "catch up" after losing a WebSocket connection and reconnecting.
The iOS and Android apps connect using socket.io clients that are locked down to only the WebSocket transport. The web client uses raw WebSockets. On the backend, socket.io is used only to support the handshake and protocol expected by the iOS/Android apps; all of the pubsub/message routing is custom.
I've no excact documentation about Trello but some ideas:
You could use Wireshark, Charles or Fiddler to monitor the network traffic between your iDevice and Trello.
Socket.io is a very nice thing and could be used with iOS (see here). It should be possible to live update a view with socket.io

Android app, open connection to to mobile devices

what is the best way to create a two way constant communication between a server and an android app?
When I say constant communication, I mean client asking server for data or server constantly pushing data to clients.
From what I saw, I can't use websockets since they are designer for server/browser setups. Is that right? If so, what is the alternative?
Is there free frameworks to work with this in Android?
What I am trying to do is an application that works like a chatting but for multiple people. So they all will get in one "room or channel" on their devices, and then interact with each other, in a way handdled by the server.
Thanks!
As far as I know , one possible way is using a web service where the client can connect to the server , if the web service is RESTFul there are many libraries to access it , one of them is the apache HTTPClient , for the server pushing the only way I know is C2DM for pushing data to clients.
For continuously-open data connection, you may use Sockets. But you should also consider the fact that an always-open connection will drain your battery quickly too. For more details, read this and this
You may want to look at AutobahnAndroid:
https://github.com/tavendo/AutobahnAndroid
which provides native Android/Java WebSocket client framework (plus WAMP = PubSub/RPC over WebSocket .. http://wamp.ws).
This is fully interoperable with WebSocket servers that server browser clients.
The AutobahnXX libraries (where XX = Python, JS, Android) are Open-Source (Apache 2.0). We (Tavendo) are offering a commercial virtual appliance based on Autobahn: http://autobahn.ws
Disclaimer: I am author of Autobahn and work for Tavendo.
But keeping the connection running on the background on iOS and Android devices does drain the battery, for people who have this issue, I suggest using push notifications when the app is not on the foreground.
From what I saw, I can't use websockets since they are designer for
server/browser setups. Is that right? If so, what is the alternative?
Websocket is an IETF/W3C protocol, so it is not confined to a specific client platform. You can use Android websocket to get a two-way communication between Android and server side. For Android websocket client, I recommend using AndroidAsync. It has all websocket API that you need to establish the communication link and exchange data between Android and the server.

Using XMPP for frequent communication with mobile app

A mobile app I'm working on requires the server to communicate with it frequently over a short period of time, including real-time (or very close) things for the app to show (from other users).
It will be an iOS and Android app.
I was researching C2DM and on this page http://code.google.com/android/c2dm/quotas.html, at the bottom it recommends considering "implementing XMPP or your own protocol to exchange messages".
What I want to communicate between the server and the app does not fall easily into XMPP's usual chat roll, how would you go about actually implementing it?
Would it be a case of choosing appropriate XMPP libraries for the server and mobile app languages, then making a custom server (and client side)? Wouldn't this drain the battery on the phone? Can it be done over a RESTful architecture?
(If it helps, there are currently no decisions made for the server - other than it has to be highly scalable).
If what you want to communicate can be easily represented as XML and is not too large, then it can be easily done via XMPP. XMPP is very extensible. You will have to write the client side (to be expected) and use one of many available servers. Customization on the server usually means writing a component (generic and supported by the spec) or some sort of plugin (this will be server specific), but without more information I couldn't tell you if that would be required or not.
It is used for much more than just chat apps, although that would be the most common usage. Pretty much any text based instant messaging can be handled (as well as others). There are a huge number of extensions to the base protocol to support a wide variety of functionality.

Categories

Resources