Facebook notification when event happens on my server - java

I'm new to FB API, and I'm completely lost through variety of them. I have Java web app, and FB login to it on my site. How can I send notification to user, when some event happens (for example, his good arrived, and we want to notify him)?
Should I use Cavans application, or Graph API? Is it possible?

https://developers.facebook.com/docs/games/notifications
Currently, only apps on Facebook.com can use App Notifications. Notifications are only surfaced on the desktop version of Facebook.com.
Meaning, App Notifications are for Page Apps or Canvas Apps and you can send them with an App Access Token to every user who authorized your App. I suggest reading the whole article in the Facebook docs, there are some important rules and a lot of important information.

Related

Send data to android app from web client

I'm trying to make it such that a click on my web client from a computer can "trigger" the android app to run its set function.
I've searched extensively but it seems like all methods need the mobile device to initiate a connection before the web server can even do anything.
Is there a way for the web client to be the one initiating? Also, is there any way to do this without notifying the user of the device, i.e. in the background? I'm using cakephp for the web client but any kind of answer will be appreciated. Thanks!
Use push notification system to trigger any action on your device. Push notification system such as Parse, PushApps, pubnup etc are available for free and some are paid too. Try them. Send a push notification and listen to that push message and on receiving trigger your action.
Use Google Cloud Messaging .
"Google Cloud Messaging for Android (GCM) is a service that allows you to send data from your server to your users' Android-powered device, and also to receive messages from devices on the same connection. The GCM service handles all aspects of queueing of messages and delivery to the target Android application running on the target device. GCM is completely free no matter how big your messaging needs are, and there are no quotas."[Google]
Here you'll find how to implement the GCM with PHP.

Mobile notifications through browser based app

Is there any way that we can have a 'pure' browser based app on mobile (iPhone & Android) to throw notifications on the mobile device?
If not, could there be a workaround which will allow my app to somehow notify the user of an alert when my app (browser) is in the background?
Thanks for the help.
With 'pure' browser app I understand a WebApp, which is not downloaded through the App Store. And in this case, it's not possible.
You'd have to write a native app with a UIWebView to reach this with push notifications and local notifications.
For this purpose you can use Google Cloud Messaging service, which provides API both for server apps and client apps.
There are sample apps of how you may implement your server application (based on Google App Engine or standalone - for generic application server) as well as mobile application.
There is similar service from Apple as well:
http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html
Going this way you'll implement server application, which would be available from any browser (desktop, as well as mobile). So there may be a page for sending a message to a mobile client of your application.
This may be long outdated answers to a decade-old question.
With ServiceWorker you can issue notifications
let notificationId = 0;
function showNotification() {
if(Notification.permission == 'granted') {
self.registration.showNotification("Notification Title", {
title: "Another Title?",
action: "Do as I say, not as I do.",
body: 'Hear ye! Hear ye!',
icon: 'thing-one-and-thing-two.png',
vibrate: [200, 100, 200, 100, 200, 100, 200],
tag: 'notification-'+notificationId++,
renotify: true,
requireInteraction: false
});
}
}
setTimeout(showNotification, 10000);
After you have asked the user to enable notifications in:
Allow Notifications!
So this works if you do it all correctly.
register the service worker
use only HTTPS
have the user enable the notifications.
What is still unclear to me is why I can vibrate but I can't play a sound? Why the vibration doesn't even seem to work on on my android? Why WhatsApp can play a sound anyway (at least if the page web.whatsapp.com is actually open)? Why on my android the notifications do not ever show up in the foreground but only on my lock screen?

Sending notification to everyone running an application, Android

Set up:
I have a system which has multiple users. Each user will download my app onto their Android phone and use it. What I want is when any user performs a specific action (I have two in my app), I want to pop up a notification in all the other user phones.
A simple break down is like this:
Start app --> Navigate to the part where action is performed --> Perform the action --> Store the action the a DB --> Notify ALL USERS --> Pop up the same notification on all phones.
How would I go about this problem? Can anyone suggest ideas or links, cause I don't even have a clue on how to approach this.
If you are looking to send notification to all users, even if all the users are not actively using the application, then Puch Notification is a good approach.
Push notifications let your application notify a user of new messages
or events even when the user is not actively using your application.
On Android devices, when a device receives a push notification, your
application's icon and a message appear in the status bar. When the
user taps the notification, they are sent to your application.
Notifications can be broadcast to all users, such as for a marketing
campaign, or sent to just a subset of users, to give personalized
information.
Have a look at Android Google Cloud Messaging
Also I have found XMPP a good solution as described by this post.
You will find some good solutions here and here
Well, you will need a database on a server, and then you will need the app to constantly (or at intervals) query the database in the background for changes, and notify the user when it finds one. A system similar to how many apps give notifications is what I am getting at.

Android WebView with notification on new message

I have messaging php based application where users login and send messages to each other.
I created an android app that is a WebView pointing to that website to give and in-app feeling to my users.
Now I'd like to add a notification feature to the app which will notify users every time they receive a message.
Is it possible to do so with a WebView based application ?
Thanks
You could send a notification from the php using Google Cloud Messaging every time there is a new message for that user.
Take a look here http://developer.android.com/guide/google/gcm/index.html

Pushing response from Server into Client in android?

i am developing an restaurant menu app in android for Samsung galaxy tab. On my app user will select the food item and user will place an order. The list of items to be served is dispatched to the server through SOAP service. Now as soon as the the order get placed from the kitchen i want to notify the user that an order has been dispatched.
What i got while searching is that i can use PUSH Technology i.e. C2DM Cloud to Device Messanging. But i had not got proper code to use this in my app. Can any one give me a proper implementation of C2DM in android?
There are many push technologies. Another option is to use XMPP, as it will work on Android.
You can check Smack and asmack for XMPP. The asmack project is an Android specific derivitive of Smack, although there are people using Smack directly as well.

Categories