Message exchange between different instances of my android application - android

I would like to create an Android application that neeeds to communicate with same application at a different device from different users. The user will be logged into the application using his Google+ account and he will be able to exchange messages with his friends. Imagine it like a chat application without a server in the middle.
The problem is that I don't own a server so the communication must be based to any Google framework or it must be implemented from device to device.
Do you have any suggestions?

I don't believe its possible to connect two devices over the internet without a server somewhere in the middle, basically there is no practical way for the devices to find each other without some known location they can both contact.
Your server wouldn't need to be too complex/expensive for testing usage. The free tier of Google Apps Engine, or a $5 PHP hosting account should do it.

Related

Implementation of data flow between devices?

A similar question was asked How to send data from one android device to another?
However their scope of data pass is between android devices.
And so to extend that question, I wanted to know ways of connecting two completely separate devices like ECG device to apps (Android or IOS).
For example, AliveCor allows to send reading of external device to their mobile app.
So what ways do we have apart from Bluetooth or TCP/IP?
You have essentially listed all reasonable means that are used nowadays. You can either transfer data via bluetooth, using your own/3rd party hosted webservices like firebase or direct tcp/ip connection. TCP/IP probably being the hardest, bluetooth being 2nd hardest and webservice being the easiest but yet requiring both devices to be online. The implementation is however totally your responsibility (with web you would either add user registration and sync user data to all signed in devices, or if sync is one time thing, you could upload data to your server, issue a expiring token, which if entered in other device allow it to download that data).
Another way is NFC(Near field communication). You can transmit data when phone(with NFC) is near to another device (with NFC). Also,
For example, AliveCor allows to send reading of external device to their mobile app.
this app use NFC for transmitting data.
From permissions ( google play AliveCor Kardia app)
Also read the information about this system on https://www.alivecor.com/faq/
https://books.google.com.ua/books?id=H-JRAwAAQBAJ&lpg=PA41&ots=EV9Qy61sjY&dq=nfc%20data%20transfer%20ECG&hl=uk&pg=PA41#v=onepage&q=nfc%20data%20transfer%20ECG&f=false

Why or when does an app need a server?

I have been searching for a proper answer to this question, have a bit of background in front end development, but with new concepts like SaaS, PaaS, etc. want to get information from experts out there, that could help any newbie to understand what it's all about.
Say I am trying to develop eBay like an app that takes a product from a user and sells it back to the other user who needs it.
Will my app need a backend server? If so why? I am already uploading my app to Google Play Store or Apple Store.
How will the backend server like HEROKU or FIREBASE or AWS help my app?
Can I implement two different services in single app, say for eg., firebase for backend database and HEROKU for payment processing?
Thanks again for your time and information.
SaaS
Answer: SaaS stands for "Software as a Service". In layman's terms, someone developed some software and hosted it somewhere. You can use that hosted software in your software project/product as a third party service (like public API); or directly use that as individual software under some license like Firebase as mentioned.
PaaS
Answer PaaS stands for "Platform as a Service". In layman's terms, someone configured some hardware and exposed the hardware controls via some web based application or REST APIs. You can use that hardware to deploy/run/manage your application without having the actual hardware on premises.
Backend Server
Answer First of all, let me explain the server. The server is a middle-man who serves whatever is requested of it, and all browsers/mobile apps act as client. So for example, the web is all about client-server communication.
So taking the example you mentioned, an eBay-like app takes a product from a user (client action) and puts it on the server (client requests in background for server to put product on server). Then another user opens the app (client action) and searches for the product (mobile client requests server to return that product, if valid and matching search criteria), and then he can buy it (mobile client will request server to complete the purchase).
You have to understand that for any communication between web application, mobile application or desktop application, there will always be a server. Even in file sharing applications like shareit, one mobile app works as server and same mobile app elsewhere works as client.
Yes, backend servers like Heroku or Firebase or AWS will help your app to complete your application business flow.
Yes, you can implement two different services in single app, say for example, Firebase for backend database and Heroku for payment processing or hosting your application/APIs.
Unless you are experienced with building distributed applications that can persist data across multiple nodes in a consistent manner, and ensure data available, I'd say you most definitely need some kind of backend. Unless of course you only plan to have user-to-user transactions, that can rely on direct messaging between client applications - which seems pretty pointless and quite far from the requirements of an EBAY-like product.
In terms of the architecture, you can follow many different approaches, but in most of them you will require some sort of data access layer. I'd recommend looking into the three-tier software design pattern (https://en.wikipedia.org/wiki/Multitier_architecture) to better understand the way this type of software product is typically designed.
After sorting out which type of data persistence you prefer, you'll need to setup the backend where your mobile app will connect to retrieve the data from (things like products being sold, user profiles and ratings, your own history). Of course you could also connect directly to the database from the app, but that would be a big mistake - it would meaning making the DB access publicly available, and thus exposed to attack, not to mention that you would be hard-pressed to find a solution for user registration and authentication, which would have to be provided by other means anyway. Typically your backend will also manage user registration and authorisation.
Heroku, Firebase and AWS are all very different, each with their strengths and weaknesses, but there's nothing like trying them out to see what fits best. What you refer to as "Google Server" and "Apple Server" sounds like a misconception, and you probably mean the Google Play Store and the Apple Store. These are not applicational servers that you can use as a backend, and serve only as a repository for your mobile app from where users can download it, and nothing else.
Without some sort of backend mechanism, the challenge of making data available for the consumption of multiple users would be overwhelming.
I know this isn't a very specific answer, but your question is quite broad-reaching, and it seems you need to look into some basic fundaments of software engineering before going into more detail.

Is it possible to create an Android application where the server side run on Android Mobile?

I am studying the feasibility of developing a mobile application for Android, for traders, where the client-side installs on a smartphone (A) and of course, through Google Play, and server-side installs itself in another smartphone (B) that installs via the Play also.
B through the merchant takes pictures of your items and upload adding a description (this article) for the application server side, in ways that the user A, which has the side application client can enjoy the products.
In short:
Capturing data to the server must be made ​​through an Android phone that can take pictures of products and upload to the system and adding text to describe the product.
Consultation of products will be made ​​by a mobile phone with Android as well.
Is it possible to do this? If not, I would appreciate to give me suggestions on how to do this. But I wanted to try not to make using computers (PC / Mac) or web app to load the data to the application. I want a system purely mobile. Maybe will use the computers to store the BD system only.
When you say the server side is a phone app, you imply that the phone is always on, the app is always running, and you need no central storage whatsoever.
You also lose any ability to keep analytics for your service, which is a crucial part of any startup.
If you want your app to have the server available even 80% of the time, and you want to keep a central database of what's going on, you must have some server you can control.
There are a lot of very cheap and manageable cloud solutions, so you don't need to buy an actual server.

Sending and receiving data from an app over the internet

I recently created an app that sends and receives commands in the form of SMS text messages, being that sending a lot of text messages could become quite costly, i'm now looking for a new method to use to send and receive the data securely over the internet. Obviously one solution would be email, although I do not think this would be ideal due to emails stacking up and accounts etc.
So basically, i'd like some advice on what my other options are....
How would sending a command using TCP work in android and how secure would it be?
How would one go about setting up sending data over TCP?
Any feedback would be great, thanks
What your looking for is Google's Cloud Messaging service. GCM is the standard way to push messages to/from the client. It requires several components to implement, however. One being a database to store GCM ids. Another is a back-end to do this.
It essentially works like this:
User downloads and installs and opens the application
Your application sends a request with your application's unique identifier to google for their GCM id (have to register on google's app center site)
Google responds to the device with their GCM id
Your application then sends (via network services or ajax in a webview) their GCM id to your server, which stores it for future use.
All of these components, however, are good things to have for growth and infrastructure support. Postgresql is a good, open-source relational database.
Other options:
1 - You could use websockets (https://github.com/koush/android-websockets)
Websockets, however, could considerably draw down the user's battery, extremely quickly if the app communicates even if it's not open, like... 'whooosh'
The benefits of using websockets is that it detaches your communication from Google.
Depending on your principals and/or beliefs, you may choose to go 100% independent by using soon-to-emerge web standards for detachment. Google (lol) "Extending the web to support personal network services" written by John Lyle, Claes Nilsson, Anders Isberg, and Shamal Faily. It's a good paper on the mobile communication debate.

Android facebook passing information between users

I'm developing an Android game, and now I'm in the stage where I want to create a multiplayer option.
My task it to pass between two users on different phones an integer.
My thought is to do it via facebook, to enjoy all the social benefits of it.
Do you know what API's\technologies I need to use?
I installed the facebook SDK, but cant find the specific API's to do it.
Thanks Allot, Vlady.
If the two users play against each other (or with each other) then the best approach would be a P2P connection, that it the two devices should have a socket between them for passing messages.
If that's not possible for some reason, then the fallback would be to have a central server to which all clients are connected, this server will then route the message from user A to user B.
As for the facebook option, what's the point?
It's not what their api is for.
You can use the Achievements to publish user scores and such, gain more engagement and virality, but that's not for the communication between the clients.

Categories

Resources