How to use a server to analyse data between two android devices? - java

Basically what I would like to do is have two phone in close proximity press a transfer button which will notify a server about both the devices latitude, longitude and unique ID. From here I would like the server to compare the latitude and longitude of both devices to check there within a close proximity of each other. If they are within the accepted proximity range the server will swap the ID's of each device so that they can then retrieve information about each other from a database.
I have been stuck for a while and seen a few options but am unsure about there difficulty of implementation and there capability of performing the required task.
I am using using Android and Firebase and have this mostly done except for the server data analysis as mentioned above. The first idea was to try Firebase Functions as it is simple to integrate with the Firebase database but I have had a hard time finding examples in Typecast to perform the functions I want. The other option I see is to use node js which I know next to nothing about and don't want to invest an unnecessary amount of time into just for it to fail.
I have searched a good amount and haven't managed to find any solutions to fit this criteria so if this question has already been asked and answered please link me to the page.
I know this has already been done by Bump but theirs literally no information available about how there back end worked.
If any of you guys can recommend any solutions to resolve this issue it would be greatly appreciated. If I forgot to mention something or you need more information let know.

Firebase cloud functions + Firebase Database is a good fit to your problem statement.
When the two devices initiate a session, you can create a node(session) on Firebase realtime DB and then have a cloud function listen to changes in a node where the sessions would be created. The Firebase cloud function could then compute the logic about the proximity and swap id's.
Where is that you are stuck?

Related

Updating RecyclerView by new set of data after publishing the app

I have a question that I would appreciate any on to answer.
my question is:
Is there any way to update some data like adding some videos, sales, values...etc in a recycle view after publishing the app in a google play without updating the app it self in the play store?
I actually don't have a clue on how to do this..
if there's any samples or websites on answering this question please share it with us.
thanks in advance
I can see a possibility but it's dirty, you can have one endpoint (/recycler), this endpoint can send you different type of data (movies, book and such), your application calls this endpoint and upon the result you parse it into one of your class that will populate your recyclerview.
I don't think you'll find any samples about it as it's not what people tends to do.
Well, if the data you want to update is writen in you code, I believe you can't update this without update the app itself.
It seems like you need a space on you app where you want to update it easily.
You should provide a backend to your app and consume the API to get all the info you need (with this, you will not need update the app itself on the store)
If you, like me, have no skills at backend development, give a chance to firebase:
https://firebase.google.com/
It will make easy to create a backend to your app. You'll need to update your app only once ( to make it work with firebase). After this, all you'll need to do is update you firebase, the app will get all new info from there

Android studio sync local database between multiple devices

I am creating a pos application on android.
The database for the app is in the cloud. That causes a problem when the internet is down. To solve that problem i have created a SQLite database that keeps needed information for the work of the people using the app. (the app sync's data with the cloud when possible).
But a new problem arises.
If a client wants to have multiple devices in his establishment, i need these devices to be synced. Meaning the SQLite databases on all the devices need to look the same.
I think i should be using WiFi direct as in WiFi p2p but after some research i am not so sure anymore. All the examples i have seen are file transfer oriented, but i need to transfer simple lists of classes.
This process should happen seamlessly once we set up the devices in the background threads.
Here is how i imagined it.
We have for example 3 devices.
All 3 devices need to have all the SQLite data on them, and another important factor is that i have a fiscalID/orderID that needs to be incremented every time a order or fiscal is printed.
So: We have a primary device, who handles the increment of the number, meaning when a secondary device wants to print a order/fiscal, he asks the main device for the id, once the secondary device gets the id, he inserts the order or fiscal, after that he sends the SQLite data entry to the main device, the main device spreads that data to all other secondary devices.
If WiFi direct is the only solution to this problem, can someone link me to a good tutorial on this topic? It seem's that tutorial's on this topic are scarce, which is a shame because WiFi direct/p2p seems like a interesting concept.
Thanks.

Android app to know the access point utilization

I am working on an android application and I want to make this app be able to tell me how many devices are connected to the current access point I am attached to. What is the best possible solution for this. I don't want the details of devices instead I just need the number of devices connected to a particular access point. I want to use this data for my web GUI which will show the utilization trend for each access point. Please suggest the way how to do this.

Count how many times an android app has been opened for all devices combined

I'm developing an Android App, and I want to know how many times it has been used worldwide. Not how many times it has been installed but rather how often it has been opened.
I read about using persistent storage to count uses per device, but I want to take all of those uses and get the total sum of these values. How could this be done?
You can use Google Analytics API to report about "main screen is opened" event. Aggregation by-days will be performed by analytics itself.
See for details https://developers.google.com/analytics/devguides/collection/android/v4/#screen-view
You can also use Crashlytics for that, check out http://try.crashlytics.com/answers/
I added a counter in an html page which is presented every time a user opens the app, this is a welcome back screen and shows some news. This sends some code to the server and increments a value in my DB. This value is then presented in Settings, which has a message that says "Sessions since 'date': 'myValue'".
Thanks for all the answers, I might migrate to them if needed.

Android Project - Required Tools

I'm in the process of starting a new Android project that will:
Display a Google map
Track and record users movements
Display the route on the map
Show local points on interest on the map
My question is what extra tools will I need to accomplish this? I can already get a basic Google Map working with zoom controls and place overlays etc. but my main concern is how I will track the users movements. I was thinking there maybe some sort of fleet management API but I really have no idea.
A link to some sort of tutorial would be great or even just to possible tools.
Use the class http://developer.android.com/reference/android/location/LocationManager.html to obtain the device geographical location
A Caltrans planning grant went towards creating an Android app called CycleTracks that does all of your bulleted items except the last one about points of interest.
You can download the source code here: http://www.sfcta.org/downloads/cycletracks/CycleTracks-android.zip
I haven't looked at the license to see how free you are to use it as a starting point, but I have to imagine it might be helpful just to be able to look at it even if the license is restrictive.
You can read more about it at http://www.sfcta.org/content/view/666/375.
You don't need any extra tools. Use the GPS or radio cells to get the location of the phone. This thread explains how you can get the location:
How do I get the current GPS location programmatically in Android?
If you want to Track the users movement you'll need to run a webservice on a server and have the app report the location of a user at regular intervals.
Be careful though, if you don't tell the user this is what you are doing, and provide an opt out, you could be pulled from the market pretty quickly.
Be sure you aren't recording any sensitive information as well. Usually position, phone type and OS type is allowed but much more could get you in trouble.

Categories