Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I've been trying to catch a push notification when the app is not running or in background mode.
I found this module https://github.com/jayeshIT/Google-Cloud-Messaging-Titanium
And only works when my app is running or in background mode. There is a way to catch push android without ACS ???? p.d. I tried creating a service with a interval but only works when the app is in background or running please help!
In order to implement push notifications for Android without using a third party service such as ACS or UrbanAirship, you must implement your own application server that stores and retrieves device registration ids that are created by Google-provided GCM Connection Servers.
Here is the Google documentation for implementing a GCM Server.
Basically, push notifications are sent from the sending device to the application server and then through Google's GCM Servers to the destination devices, where the devices' operating system receives the push notification an displays it appropriately.
It may be easier to implement push notifications initially using one of the free accounts on the third party services (ACS, UrbanAirship), and once the mobile functionality is developed and tested, implement the application server and refactor the mobile code as needed.
Hope this helps. If so, please up-vote (need the rep to use other features in SO :)
I would start with the Urban Airship module: https://marketplace.appcelerator.com/apps/4984
The module has support for iOS and GCM and its open source. Here are the direct links to the builds: android and ios
http://urbanairship.com/ They have a free tier. If nothing else this will get you started, and once you have this setup it will be easier to try and do it yourself.
There's plenty of documentation for setting up the API Key's for GCM, do you need me to track those down to?
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am working on a chatting app. In which one user sends message to another user. So there are two users(user1 and user2). when user1 sends a message to user2. On back-end I am sending the message to my web-server using post method, then user2 is always sending get request to server and receives the message in response. In this way my job is done but my question is that if there is any way to send a request from web-server to phone? and user2 can directly receive the message without sending request to the server all the time. Please help!
As #Linesh said above, could be one possible solution but rather unconventional using GCM for chatting purpose; instead you can make use of standard web sockets, which could be easily implemented in node.js, or PHP,Python, whatever server side programming you are supposed to be using. also based on websockets , have look at socket.io or you can make use of some third party chatting API's like quickblox, or pub-nub or even AWS as well.
Yes there is a way. You can use GCM to send the msg to phone.
The working would be like.
register both the devices with gcm and store the registration id to your server with the unique user id
when user1 sends some msg to server. then get the registration id of user2 and send the msg to gcm server.
user 2 will get the msg when he connects himself to some network.
this links will might help you
http://www.androidhive.info/2016/02/android-push-notifications-using-gcm-php-mysql-realtime-chat-app-part-1/
http://www.androidhive.info/2016/02/android-push-notifications-using-gcm-php-mysql-realtime-chat-app-part-2/
One big downside to using 100% GCM is that it can tie you to Android unless you take extra steps in your design to ensure that you can use other services too - with an improper implementation you could only do chat between Android phones but not, for example, Android to iOS, Windows Phone to Android, or Android to desktop client. This ends up being a significant downside since, based on statistics I saw recently, Android has an approximately 66% market share. While this sounds like a lot, this limitation would mean that you couldn't chat with 1/3 of people. iOS, Windows, and Amazon phones/tablets all use different push notification services. (One possible solution to this is to use AWS SNS Push, which will act as a "matchmaker" for different push notification services; this would improve the platform independence to some degree).
SignalR is another option. There are actually quite a few examples of chat apps out there that use it - it seems to be the canonical example actually.
I've built an Android application by android studio.
I want to be associated with users online and notify changes and news.even when my application is closed.
This is what is on my mind,I have web server, i want create a internet connection listener and when connection is available,application or a part of it connect with the server and get new information and notify the user with a notification.even when my application is closed.
How can I implement and enforce it?
Try "Google Cloud Messaging."
Per their Developer Console Help page: "Google Cloud Messaging (GCM) is a free service that helps developers send messages across multiple platforms: Android, iOS, and Chrome. For example, a server can send messages directly to single devices, groups of devices, or devices subscribed to topics. Also, the application on a device can send messages directly to a server and to devices belonging to the same group."
Use the Google Cloud Messaging service alongside the Google Plugin for Eclipse. Google Cloud Platform explains as: "When targeting Android devices, it is easy to get started by using Google Plugin for Eclipse (GPE). GPE allows you to generate an App Engine Connected Android Project that provides the basic logic needed for sending push notifications using Google Cloud Messaging for Android from a mobile backend running on Google App Engine."
This could send messages for you without having to do the work on your own server. If this answer helped you, please consider up-voting or accepting it as the answer. Thanks, and best of luck on your project!
No,These systems are always some limitations and managed with others.I do not need to communicate with iOS or chrome ,I need to design a system that's all for me.Experience has shown me great services, such as Google services and any other company affected by political issues.for example i live in iran right now.
All production-oriented and knowledge-based services for this country is banned.
due to this problems i prefer to have my own messaging and notification system.
I am looking to implement notifications on my app. The way I would like for this to work is when I put something on my website, that is connected to my app, it gives a notification automatically even if the app is not running. I am just looking for the easiest way to accomplish this. By the way the info that is added from the website is put into a listview in the app(if that helps at all).
The server needs to do a several things in order to talk GCM:
http://developer.android.com/google/gcm/http.html
The client needs to do some registration and let your server know of the GCM registration ID:
http://developer.android.com/google/gcm/client.html
Those links will provide much more detail though
Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted.
Your app may poll your side every N minutes/hours/days or you can use Google Cloud Messaging service.
GCM: Here is a link describing the usage of GCM with a PHP web server:
http://www.programming-techniques.com/2014/01/google-cloud-messaging-gcm-in-android.html
So if you have any update on your site this can notify GCM which will notify all registered users (their devices with your app running).
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Group,
I am planning to implement my own Server push notification server to Android/IOS apps. So My application server (which may be implemented through NodeJs) will contact that Notification Server to push messages to devices. So i surfed through internet and found the below existing solutions.
Google cloud messaging
Apple push notification service
Firefox os push notifications
Microsoft push notification service
Q1)
On their respective sites; they were informing only about how to use their notification Server. However i need info on how they implemented their server push.
Please tell me; are they following any of this below?
Polling
Long polling
Streaming
Server Sent Events
TLS, SSL or TCP socket connections with Client
XMPP
Q2)
Below two methods are claiming that though my app is not running; they can still be able to sent notification to APP? How is that possible?
Apple push notification service
Firefox os push notifications
Q3)
In Firefox os push notifications; they have informed that they were avoiding keep-Alive to save battery life. My question is without keep-alive how to determine the connection is still alive or not ?
Q4)
Is this all these (GCM/APNS/FireFox OS) implementation is only Server side pushing, and won't accept requests from Client. Am i correct?
So still my server has to handle millions of device requests other than push messages, right?
If i use websocket between my own notification server and client devices, do i need to maintain one more websocket connection between my application server and clients to receive requests from devices ?
There are good articles available over internet, you can go through you will get answers. However I am trying to answer your question:
Answers are mostly true for android and google servers.
Ans1)
They have their listeners which has to be used by you by using their library classes in your code. You need not to bother about pushing. You have to send the message to server server will push the message to the device. They use OAuth.
Regarding Protocols, there are two methods using CCS and XMPP. CCS just uses XMPP as an authenticated transport layer, so you can use most XMPP libraries to manage the connection. To send notifications to device you can write code in android app to send as well as your server code. the message sending will be done only by your code. Rest will be taken care by Google Server in GCM case.
You can check detail at this link
http://developer.android.com/google/gcm/server.html
Also, for security issues
google cloud messaging security
https://groups.google.com/forum/#!topic/android-gcm/M-EevBitbhQ
Ans 2)
Yes in case your app is not running then also devices vcan recieve notification because you have to write code for broadcast listeners. In background it will be listening to server and whenever any message packet will be there it will recieve the message as notification. Android has service you need to not to bother about it. You have only to use those resources using the library class that makes your work easier and let them write if your app is not running then also it recieve notification. Obviously, there would be some listener whick make the app to recieve.Check "Recieve the message" section in this link
http://developer.android.com/google/gcm/client.html
Ans 3)-
Firefox OS Push Notifications are designed for one thing – waking up apps. They do not deal with data. Check this link
https://hacks.mozilla.org/2013/07/dont-miss-out-on-the-real-time-fun-use-firefox-os-push-notifications/
Ans 4)-
No it will acccept request from users also.
I am not sure for others, but for GCM it will do.
Please check "Send a message"
http://developer.android.com/google/gcm/client.html
Hope this helped you with your question.
Apple push notification is controlled by iOS not your app. Thus this is available even if the app is not running. To send a notification you open an ssl connection to the apple server and send the push notification payload. There is no polling or anything since iOS will handling everything.
If you intend to write your own server you can not user push notification and will drain the battery since you will be needing to pull message from your own server. Apple APNS is controlled by iOS, it connects to Apples server once is a while and collect all push notifications for all apps on the device.
Technical details aside, there are various third party solutions such Amazon SNS. Per million notifications should be about $0.50. Comparing this tiny cost than implementing your own servers/services (time, costs, reliability), I feel you should spend the time on other aspects of your project.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am new to GCM and have a few questions regarding an app implementation. The app should be capable of upstream messaging. So -
Do I have to create a server (lets say in Google App engine) which will communicate with GCM. And then GCM will send the message to the app. Or I can do it just with CCS connection and my device can send message to app on another device without a server?
Is there a code example of writing server side code which I can use in App Engine? I badly need some tutorial/code implementation on CCS to understand the logic. I dont think android developer site is enough to understand things clearly.
Help appreciated!!
Hi Actually I am using http://parse.com to create server and push notification in android.
First of all you should always go to the source and read, as Google provides samples and everything.
About 1 and 2 then it depends if your going to use a third party provider or do everything yourself.
If your making everything yourself then YES you need a server and YES Google provides some code but I've never used it so I can't tell you how much work you have to put in it.
If you just want GCM capabilities but it doesn't have to be Googles, then there is plenty of alternatives out there: Parse.com and Urban Airship to name at least two.
Following link will help to code GCM but it is unidirectional(from third party server to cloud only)
http://avilyne.com/?p=267
Google GCM CSS provides upstream messaging that is from application(http://developer.android.com/google/gcm/client.html), you can send a message. This message will reach the Google server and they will send you the same message to your server, which you have to implement(https://developer.android.com/google/gcm/ccs.html).Do what you want with it.
If you have to send a message from your server to the client(application), you can send it via your css server or by making a http call to the google gcm http server. They will send the message to the client. You have to handle the received message and can show as a notification or use internally.