working mechanism of mail android app - android

I want to know the complete working mechanism of the mail apps for android.
Actually I build an android app for big data product.It has a feature which will shows the notifications (list view) .
Now I want If new notifications come in the DB It should ring a bell and in notification bar of the android phone it should show, As in case of Mail apps, as soon as we got new mail a notification comes in notification bar.
NOTE: android server which needs to be queried may not contain internet.This App works on intranet also.within a company network.(without the internet)
So I want to know the mechanism to implement this feature.
1) Whether i should run a background service which will send query to server on regular time interval.
2) Or any other services like push notification.
I just need a clear idea about working of these type of system.So that I can implement this in effective manner.
Thanks

Obviously the best solutions would be to use PushNotifications. This is how GMail does it, and this is how every email app, or messaging app has to do it.
Polling the server will drain the battery, and will also make extra (unnecessary) data traffic, which is something you don't want your app to do .
You should get started here : Google Cloud Messaging. In my opinion it is very easy to setup, and I recommend using GCM, instead of all the other alternatives like Parse and so on.

Related

Push Notification from local server

I am building my first Android app and need to know how I could use push notification.
My project is a home alarm system and also I have built my own local web server. Now I want to push a notification from my server to my Android app when an alarm appears in my server.
Currently my garage doors use the MyQ app and when the garage door opens or closes I get a notification on my phone, I want to implement the same thing in my app.
I've been reading about the Google Firebase Cloud Messaging but it seems exceeding my need.
If you need push notification on your cell phone then you definitely need to integrate your app with Google Firebase. (or at least that's the right way of doing it).
Alternatively, there is something called as local notifications & background process in Android you could do long polling to check if the garage door is open (probably every 2 mins or something). However, I don't recommend that as it can drain your mobile battery.
Also I recommend using Flutter as oppose to using Native Android. As there are some pre-built libraries for android and Google Firebase integration.
Take a look at this Youtube video - https://www.youtube.com/watch?v=2TSm2YGBT1s
Ouh, maybe thats a little bit too much for starting with android - nevertheless I want to help you.
You need a communication protocol between your server and your phone (i.e. Firebase as you mentioned or Websockets).
If your server sends a message to you client (your phone) you have to create a notification. (Android Developer Guide). That's the theoretical part. You will also stumble across a lot of
challenges with
asynchronous programming.
Firebase might actually be the simplest option. You could build your own web socket service too, but that would probably be more than you need. See this previous question for more options: Android push notification without firebase
Android has some services that communicate with firebase to receive notifications.
You'll need to implement a service on top of your web server (using backend languages such as Python, Node.js, PHP,...) so it can send notifications when an event happened (like the door closed) witch isn't a simple way for a beginner.
then your web server sends a message to firebase and tells it to send a notification to my client.
so I highly recommend using firebase because of the simplicity of usage. otherwise, you should implement a separate service on your android phone to get the notification (if you want to run it locally) also as explained do the backend side.

Can I use onesignal to trigger change order status automatically?

Can I use Onesignal to send a notification of order changes to an Android device then if the user already opened the application on order's page/view the notification will be not shown but the order status on that page will be changed?
If yes, can I know the reference of documentation/tutor? If no, what are alternative ways to do it?
I have a project using Onesignal to send the notifications to the android devices. Currently just Simple notif, but my boss asked me to make the mobile app can auto change status order without user action. I'm a backend engineer, not an android dev so I don't know what really works of Onesignal in android. I just know Onesignal can be used to send the notification but what about data process after notification sent?
This is what I understood: Your app has some kind of market or something from which people can order stuff. So, you want to know if OneSignal can send automated notifications as the order status changes?
If I have got it correct, my best guess will be, no. OneSignal can only manually send out notifications. The closest one can get with OneSignal to automations is scheduling notifications to be sent later. To achieve your purpose, your Android devs will probabaly have to write some code on their own and integrate it some way with the order status and all. Or else, your boss will have to appoint a few people who can track the order of the people and manually send out notifications to them using OneSignal (but, identifying the correct device might not be so easy).
That's my guess. But, OneSignal's support team is pretty nice. They might take a few days to answer, but, it's worth asking them if they can help your developers integrate the order status and OneSignal's notifications in some way.

Receive notifications on android upon database change

I have an android app which is capable to interact with a (for now local, but in future online) RESTful database (using PHP and Slim framework).
A registered user can create/upload new text, view all its texts, delete and modify them.
The user can log through different devices (Android smartphones for now, but in future with Desktop computers as well) and perform said operations.
I need that EVERY device (on which the user is logged in) is notified upon each change in the database.
What is the best approach to implement such notification capability either on the PHP/MySQL server and in my android app?
I have heard about Google's Firebase Cloud Messaging but i'm not sure neither if it is the easiest and fastest way to do it, nor if it is compatible with my already working environment.
Please guide me in the right direction as i don't have a clue on what is best for my case.
You have to registered mobile device or desktop to fcm/gcm server or apns in case of iOS . When database is updated on server then it will get a trigger so on after save will send notification push with your payload.

send and receive notifications in android

I am developing an app in android in Eclipse IDE. The app modality requires that any user can challenge his/her friend to do a certain activity. Whenever a user does so, the friend will immediately get a notification in his/her phone. Even more, the user who challenged the friend, will also receive a notification when the friend accepts the challenge. Is there any particular way I can provide this functionality? I know how to generate notifications. But the server side interaction is quite confusing. Should I check the server database through the app at frequent intervals and check for such activities in database? I think the procedure will hamper the performance of the app. I would be very grateful if anyone can suggest a good way.
But the server side interaction is quite confusing.
As you're pointing out, it's the server part not the Android one what's confusing here. If you don't have any constraints on the server part, I'd recomend to use Socket.io http://socket.io/ They have a tutorial for connecting socket.io with Android: http://socket.io/blog/native-socket-io-and-android/
It seems that you don't really need an interaction between the differents users but only a way to notify them. I always used Google Cloud Messaging to do so. It enables you to receive push notifications. As you said, checking the server periodically is battery/data consuming and not the best way to do it.
This link might help to set up GCM : http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/.

In-App messaging vs Push Messages: Pros and Cons

I am finding difficulty to know about in-App messaging.
And how to do it.
I have the following things in my mind,
in-App messaging:
Is an idea to receive contents from a server only the app is alive on screen.
This is possible only the app is active.
App should make a call to server and needs to receive contents.
Push messages
Is an idea to receive contents from a server even though the app is not active.
This is possible at any time, we can notify users while our app is closed and running also.
App do not need to make a call.
But the app should have code implemented to receive push notifications.
We can use GCM for Android and Push Notification for iOS.
Am i right with my understandings ?
If i am not and i missed something , please give your hand to take me out of this confusion.
Thanks,
When I think of in-app messaging, to me it means that you're sending a message from one part of your app to another. "Sending a message" is a very generic term that can be accomplished in a number of different ways. Among others:
Sending a broadcast to a message receiver. You'll need to call sendBroadcast to a BroadcastReceiver.
You can pass a Handler to another component and it can post messages to your handler where they're processed
You can use a third party library such as the open source "otto" library
You can build your own version using the observer pattern.
For push messages, your understanding seems about right. However, look at this post for details on the last item, "We can use GCM for Android and Push Notification for iOS".
You are right, though I would change the term in-App Messaging to Pull Messages, since you are referring to the app pulling messages from the server, while in-App Messaging implies that the application is sending the messages.
You points are mostly correct, though Pull Messages does not require the app to be in the foreground (on screen) - a part of your app can run in the background and fetch messages from the server. This is more doable on Android, since iOS limits the operation an app can do in the background.
Another point that should be added to your list is that Push messages also have the advantage of conserving battery life.
In-App Messaging can also be viewed from another standpoint. AT&T has an API for In-App messaging that allows you to send SMS cross carrier. The API can be found here. along with others. From this you can imagine the ability to message from within an app, say a game or a social app and retrieve responses. There are examples for all the platforms you have added as tags. It might be good for you to look this over as it can expand your understanding of the concept in a different direction than the other answers, Somewhere in all of these you will find what you are looking for.

Categories

Resources