Android connection with other phone - java

I want to create a simple social app. On this app, users can communicate via the internet. It will be a simple connection - notification sends from one to other users. (ex. user A sends a notification to user B. User B see a notification from user B).
How the best achieve this communication? Is Google Cloud Messaging is the best solution? How can I calculate costs?

You should consider using the Firebase tools. With the details you provide, you will probably want to use a combination of Firebase Realtime Database + Firebase Cloud Messaging + Firebase Cloud Functions.
You choose a path on the Realtime Database to be the place where you write data. For instance, write messages to users/:user_id/messages. Then attach a trigger to this path with Cloud Functions, so every time something is written to this path you can fire a notification to the the other user with Cloud Messaging.
Reference:
Cloud Messaging
Realtime Database
Cloud Functions

Check out Firebase Cloud Messaging .

Related

Is there a way to make MongoDB Atlas Cloud DB work like a Realtime Database?

I am making an Android Java Application which requires following features;
Required Features for the Application
Messaging between 2 users or multiple users that include;
Text messaging, Voice messaging, image messaging(Just like WhatsApp)
Push Notifications whenever a user gets a message, or someone takes a screenshot in chat (Just like Snapchat)
In App Voice calls and Video calls
Technology Stack
Java for Android in Android Studio
NodeJS for making API
MongoDB Atlas Cloud Client for Database
What I did
I was making the API Get request to Get all the messages from the Database and display it on the RecyclerView but since the Database is not Realtime so whenever a new message is added in Database then I would have to open the application again from scratch so that a new Get request is sent and the data is fetched to RecyclerView.
Question
Hence,
Is there a way to make chatting Realtime with the mentioned technology stack? That is; with NodeJS and MongoDB Atlas Client without having to buy the realtime database?

Can one send data fom firebase database to email?

I have a firebase realtime database that stores information about voters for my android app. Is it possible to send the details of this database eg (vote results) to registered voters? Im using email/password sign-in option.
Thanks already.
You can do it in several ways, it depends on your architecture, Firebase Firestore won't automatically send any emails, but you can use Could Functions to execute code when you change a document on the database, then use the Cloud Function to send the emails.

Android create notification automatically

I want to create a notification in my app , when data downloaded from API changes.
Example:
I want to create a notification when a Twitch streamer start
streaming.
I want to create a notification when a Twitter user posts a new
tweet.
I want to create a notification when a YouTube user uploads a new
video.
How can I do this? Periodically download data and check changes? How do I create this task if the application is destroyed or the device is restarted? How do I do it so I do not discharge the device's battery too much?
I know how to download data and how create a notification, but I don't now how to create the described task.
the best practice here is using push notification.
all you have to do is registering you app with one of the well known providers of the service like FireBase Cloud Messaging and then configure your app's server to send notifications to the Cloud Messaging service which will handle the delivering of your notification
and you won't have to worry about battery usage because they use google play services to keep a connection open and they even display the notification themselves.
they provide many other features you can use and they are optimized in the best possible way.
you don't have to reinvent the wheel

How to connect android users to my database / web application?

I have wrote a simple web application with few tables. It has it's administration area where you can manage it's table. Basic CRUD operations.
However, I need to develop an Android application which will retrieve information from this web application trough API. So I am going to write a simple API methods for fetching data. Also there will be sometimes when Android user will save some of its data to database.
Android application needs to be able to list items stored in database and bookmark some of those items over HTTP.
To me problem is how to implement SingIn / SignOut operations using Android's Google account. For example, application GMail is always signed in (at least on my device) and I want my application to be always signed in.
Then, how can I manage what items user bookmarked? Should I create a table android_bookmarked_items (android_user_id, item_id)? But then what should be android_user_id? Do I need to use OAuth?
I am doing this kind off sign in for the first time and I am really confused how to connect this web application with android user and manage bookmarked items per user...
You can make use of Android AccountManager. Check out How to get the Android device's primary e-mail address
I think i have found solution by using Google Sign-In for Android. I get idToken for currently login user before each POST request and verify it on server side. Also from the token I get property sub which is user id and store this in my database...
Auth with a backend server
However, I am pretty new to this stuff, tokens and authentication using google, I would like for someone more experinced to confirm that my solution is fine and secure...

Android Google CloudSQL

Currently I stored data from my Android / Java app in SQLite on the device. I want to dump this delimited/structured data to a mysql insance on Google CloudSQL. I have a google cloud account, setup a DB and have the cloud back end all ready. I have plenty of DB experience but am weak on java, cloud, etc After months of seeking working examples (GAE?) I know about this link:
https://cloud.google.com/appengine/docs/java/cloud-sql/
But it's not complete.
Can someone just post a very simple app that successfully executes a simple insert from Android/Java into Google CloudSQL and include all the code needed to get the data to the CloudSQL instance?
If this is a duplicate question and the complete code sample is already on StackOverflow I will gladly read it. I have not found a complete example yet.
Thanks in advance.
Try using Firebase or Realm instead to facilitate data flow to your mobile App. Firebase is built on reactive programming model where data is saved in Friebase and automatically synced with client device. Realm goes a step ahead in having you abstract a true API call via its interface. And otherwise yes as others responded your mobile app HAS to actually call an API service and not CloudSQL directly

Categories

Resources