I’m playing around with Google Play Game Services and multiplayer support. If I invite a player with this service, is it possible to send a notification to the receiver automatically? When I use the demo project nothing like this occurs. The documentation however says:
If the signed-in player accepts an invitation from the notification area on the Android status bar, your app should accept the invitation and go directly to the game screen (skipping the main menu).
This doesn’t explicit says that notifications are supported, but it gives my some hope at least :-). According to this question: Google play game services invitations get lost notifications seems to be supported, but I have never received any.
notifications are supported and will be sent to the receiving player... if the players are not in each other's circles sometimes the notification does not get displayed, depending on the receiver's settings. maybe that is why you haven't received any?
Ok, I finally solved much thanks to #smiller.
First of all I had my test account circled just as Following. This is not enough! Some other circle (Friend, Familiy etc) has to be used. If the person is just in the following circle, onRoomCreated is called with status code 6 (STATUS_NETWORK_ERROR_OPERATION_FAILED) on the inviter's application.
A secondary problem I had was that data synchronizing was turned off on my device. Obviously this has to be turn on. Unfortunately the inviter never get some feedback on this, it just waits forever.
Related
I'm building a newspaper-like app and I would like to know how many people received the article's push notification vs how many actually read it.
I was thinking to implement a way in which when the notification is received the app wakes up and send a request to the server saying "Hi I'm _____, I've received the notification of the article ____" and store it in the database. Then afterwards if the user click on the notification and goes to read the article I send another request saying "Hi I'm ____ and I've read the article _____" and I also store it on the database. Afterwards with some queries I'm able to understand the percentage read/received.
I don't understand if it's even possible to wake up the app even if it was not opened by the user in a while and send a request to the server (for background is meant that the application is not launched or that is in the cache ?).
I would like to achieve what they did with Whatsapp:
I receive a new message on Whatsapp
I don't open the app
I go to WhatsApp Web
I open the conversation on WhatsApp Web
The badge and the notification on the phone goes away because I read it somewhere else
I think that that feature is achieved with silent push notifications that just update the app badge and clear the read notification.
Thats a very nice question on how to implement such silent notifications. There are few variables here that we need to consider and deal them in a different way.
Push notifications sent to the users - Some of them would have received it, Some may not have received it at all.
Pushing multiple notifications to the same user in a small amount of time - It becomes difficult here to track the exact notification user opened the app. Because user might have read all the news that received notifications in a single attempt.
The actual content displayed to the user in the app - User might have opened the app because of notifications. Some times he might have seen the notifications and then opened the app directly without interacting with the notifications.
So this is how the implementation can be.
Implement push notifications for the app
User receives the push notifications and the notification badge shows Number (1).
Now when the user views the same news story in any other medium (Your own Mac App or PC app). Server is notified of the users action and the news he/she/whoever just read.
Now the server knows it has sent a notification and it is not read. When you receive the read notification, you can send a remote notification that can be handled by the app in background and update the badge.
Check out this link for more details on how to handle notifications in various modes.
Apple documentation also can be referred here for background mode - remote-notification.
So you will be making your app run in background with certain settings to respond to silent notifications and update the badge just like WhatsApp. I hope this helps.
I've already implemented such thing in one of my app, and it's actually tricky.
You'll have a lot of use cases to handle.
First thing (but you seem to already know it): Apple does not provide
any callback to say : "this notification was sent"
Second thing : when your app is killed (not even in background), nothing at all can be done with your notification, meaning your app won't be able to wake up and read the notification, and therefor do something. The only thing you can do is changing the badge number, even if your app is killed.
Third thing : when your app is in background, you can wake up your app during 30sec. During that time you can send a request to the server, but if it takes too long, the process will be killed by the OS.
Saying that, here is a quick explanation of how you could implement the system:
You'll need on the server side to save in your data base any notifications that were sent. As soon as they are sent, save them as "pending"
On the app side: if your app is in background, as soon as the notification is received, you can wake up your app to send a request to the server. Then in your data base, your notification status will change to "receive" or "notified". If your app was killed, when the user launch your app, send a request to the server to ask for all notification in "pending" state, that way your app will be up to date, as well as your badge number.
If the user click on the notification, this will open your app directly on the article, that way you'll be able to send a request and say to your server that the article was received and read.
If the user read your article on the web side, send a notification. Set the notification badge number with the number of actual "pending" notification in your data base.
Hope this will help you in addition of the answer of #Prav :)
try this Notification Listner service https://github.com/kpbird/NotificationListenerService-Example.
Reply from Apple Developer Technical Support:
Hello Matteo,
Thank you for contacting Apple Developer Technical Support (DTS). Our engineers have reviewed your request and have concluded that there is no supported way to achieve the desired functionality given the currently shipping system configurations.
So at the end of the games IT'S NOT POSSIBLE
You want to sync your app with web app or website than once you send notification to application than set notification to particular ID.If user read that message from your web then send push notification again with different message and handle in service or broadcast receiver after that cancel notification if received message contains different message.you can also use Notification Listener.Refer thislink
Refer this link for ios.
Hi #Smile Applications after reading your question I would suggest you see OneSignal website. OneSignal will allow you to send notifications to your subscribed users. It will also show you how many users are using your app and how many of them have received your notifications. If you want to send notifications and track them from the app itself you can use their API. It is easy and I have implemented this in Android and soon will be implementing in IOS.
Now the second part of your question about knowing how to track how many users have read/opened your notification and on which activity they are on you can use Google Analytics. It will allow you to see from which part of the world your users are using your app and which activities of your app are being opened most. It is also easy and I have implemented this also in Android and soon will be implementing in IOS too.
I'm mainly reaching out to the Twilio team active on here 😀 and for the benefit of the community.
Our team will is looking to implement Twilio IP Messaging to fulfill our app messaging requirements. One of the use cases we'd like to handle is the ability for a user to turn off notifications for a specific channel. I don't see anything in the docs that speak to this, so we could of course implement the logic on our servers. But, I don't see the ability for a pre-event callback for something like onNotificationSend to check if a notification should go to the user. I don't want to use onMessageSend since the message should still go out, just not the notification.
My other thought would be to intercept the notification in the app and check our app state to see if that channel is able to receive notifications. Reading the docs for iOS notifications, it looks like I can determine what to do with notifications outside of the app being open, I just wanted to check if that was the best/only option for this scenario.
Thanks in advance for any help.
-Brad
I got the opportunity to talk to the Product Manager for IP Messaging at the Signal conference, and he said the ability to mute channel notifications is in the road map. So I think I'll wait to implement something until that comes GA.
I am attempting to make an Android app which will allow a user on a queue system to be notified if it's near his turn.
I would like to know if it's possible to make an Android App, that would upon connecting to the internet, connect to a server and then get assigned an ID, which would compare it to other IDs and check it's position on a queue. If it's"for examnple" less then 10 people in front of the user, to send a push notification, even if the app is closed, saying it's almost the users turn.
If it is possible, is there any tutorial available on the matter? I searched a while, and nothing of what i found appeared to be my solution.
Wrong choice of words perhaps.
EDIT: What i am asking for, isn't a tutorial to build the whole app itself, only a tutorial to make automatic push notifications upon connecting to the internet basically
My implementation of the GCM works normally when the app is in the background or shut down, as is should be.
But when the "Background data" (in the "Account and Sync" setting of the device) is disabled, I do not receive GCM notifications anymore.
I am not 100% sure if this is the sole reason is the "Background data" setting, but based on our experiment, it seems like the "Background data" is the variable for whether the app receives the GCM or not.
My First Question:
Is this an expected behavior, or are we doing something fundamentally wrong?
My Second Question:
I have heard from a fellow programmer that some people create a new Service to live in the background and listen to incoming GCMs.
I am still trying to figure out the logic behind this, but does it sound like a viable option?
Sorry for being vague in my question.
I am still struggling with the design of the solution to this problem so...
In the same way that Google Play requires background data enabled Google Play, I guess GCM do so.
When you try to acces to GCM and there is no account registered on the phone an error ACCOUNT_MISSING is returned by the GCM services, and when you detect it you should redirect to the ACCOUNT_SETTINGS so users could add a google mail.
After that, you will have to detect if that background data is enabled using the ConnectivityManager function getBackgroundDataSetting().
Take care of it, it was deprecated on >= 14 API, you will have to use getActiveNetworkInfo() instead to see if apperas as disconnected because the user has disabled background data.
Other way if you see the last link is registering a listener with the filter ACTION_BACKGROUND_DATA_SETTING_CHANGED (but deprecated on API 16).
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(ConnectivityManager.ACTION_BACKGROUND_DATA_SETTING_CHANGED);
According to the android manual :
Background data controls whether applications and services can
transmit data when you are not working with them directly
It doesn't explicitly say that background data is GCM but there are lots of evidence and a bunch of threads that all say :
GCM messages are not delivered when background data is disabled
you can easily test it yourself, disable background data, go to the web version of play store install an app. You will only receive it when you re enable the background data. If not even google can make it, then likely you wont be able either.
If you still think you saw applications receiving GCM messages when background data is disabled it can be because of :
In newer android phones you can enable background data per application, probably it was enabled for an another app
Probably what you saw was not a GCM notification, but the application falls back to polling the server when GCM is not available
If you are still not convinced then set up you phone to use a proxy server like burp suite on your machine and you will be able to see what other apps are doing on the network.
I am creating a app in android 4.0.3 i.e ICS version, which connects to the server when client gets login into the app.I am trying to get status of an client when he gets online or offline through server & seen onto the app screen.I am unable to proceed. Can anyone say me:
Is it possible to get the status of an user through server?
1-- How to proceed for first step...?
2-- How should I get a response from the server that the client is connected & viewed to other client example - when we login into skype our status shows available with green radio button, In same way how can I get it.?
It ll be very help full, If anybody guide me.
Many Thanks..
I'm assuming you're trying to develop a chat app ?
If this is the case, try using an XMPP library. XMPP is widely used for chat apps, including Facebook chat (and Google talk I think) and there are plenty of open source libraries available.
Otherwise, if you only want real-time notifications as a part of a bigger picture, try using push notifications. Google supports Cloud to Device Messaging (C2DM) for android. It allows to have push notifications to a specific device without you having to deal with persistent connections, battery and CPU use .etc.
C2DM approach comes down to this. When a client connects to your server, get a list of his friends and their 'C2DM IDs' and fire a C2DM push to their devices. This push is delivered to your app, and you can respond to it by firing a notification, or update UI .etc. (Your app doesn't necessarily have to be running. Push notification is delivered via a specific broadcast, and your app can register a receiver for it to wake up.)
Keep in mind that there is a quota for C2DM messages per device, per app and also a limit for the payload per message. So you're not supposed to send massive files via this. Just a notification to your app, so it can call your server and get an updated list, instead of polling.
You can get more info on C2DM and code samples here. https://developers.google.com/android/c2dm/
Hope this helps.
You may have moved on, but I'm posting for anyone who would run into this one in the future.
Firebase is a good solution to use in this scenario, if the app is always running when you want communication to happen. (It will not wake up your app as C2DM/CDM does, unless you have a service running all the time and still wouldn't wake up if the device is asleep... AFAIK)
It may be useful for some scenarios, but may be not for a chat app as you want the device to wake up when a message arrives.
Note that they have limitations on the free subscription though.