I am wondering if it is possible to send push notifications to different Android applications. I can already send a push notification in same application but I want to send notification to different applications of mine. I have user application and driver application. I need to send push notification when user create order and driver get notification that "A new order is come" after driver accept. Acknowledgement notification get back to user.
I am using two different Google API for both Application, I think, its not good way...
Please give idea about this. ? thx
What you want is possible and not that strange at all, you have two applications registered for push in the developer console with two projects ids and want each of your Android application to be able to receive notifications from both ?
If thats what you want its possible you just need to register to both sender ids in the android applications check.
https://developer.android.com/google/gcm/adv.html#multi-senders
basically:
...
if (gcm == null) {
gcm = GoogleCloudMessaging.getInstance(context);
}
regid = gcm.register(SENDER_ID_ONE, SENDER_ID_TWO);
....
push notification with 2 different apps are possible,i make it one database for both apps for save token id, generate 2 push notification. its working fine
Related
I'm using firebase push notifications php api with android...
When I send a notification from firebase API, to android device, I also make a MySQL input, to register one copy of that, and work!
but...
What happen when the API sends too many push notifications?
There is no problem with my shared server?
I'm worried that my server will collapse for too many records for each push.
Right now It work like this...
Firebase API PHP send notification -> MySQL register that notification in one table -> Android Device recieve the notification.
but I don't think this is the right way...
so... the question is...
what is the proper way to save a firebase push notifications sent...?
Goal :- Detect database changes of firebase.
I am using firebase PHP CLIENT.
With using firebase php client i am able to
Connect to firebase node
Add / update and delete nodes.
List number of nodes.
Above functionality works perfectly.
But i want to achive functionlity of push notification when user goes offline in to the group as well as person to person chat.
Firebase database is real-time database so, how can i detect the changes of firebase database nodes so i can keep on watch on the message node changes and i should fire my push notification API from php.
The main functionality i want to achive is sending push notifications to group and person to person using firebase chat to mobile platform ( Ios and android ) .
Is there any alternatives avaialable for the same? OR any plugin which will does the same job?
Or in the another way is there any posibility to send push notifications using mobile end ( web independent ) ?
Any help would be appriciated.
Thanks in advance.
I want to send messages to multiple users/Endpoints ARN selecting from MYSQL database without using Topic using PHP SDK.
Amazon Mobile Push can send notifications in two ways:
Push a message to a single end-point
Send a message to an Amazon Simple Notification Service (SNS) topic, and that topic pushes to multiple subscribed endpoints.
To send messages to multiple users/endpoints from a MySQL database, you would need an application that reads from the database, determines what message to send to whom, and then send that individual message to one endpoint. To send to multiple users, use an SNS topic.
See: Amazon SNS Mobile Push Notifications
Unfortunately - SNS allows publishing to multiple endpoints using topic. So you'll have to use that. Keep in mind though for the topic subscription will only work one call at a time for each end-point. It does not have bulk subscription to topic feature yet:
https://forums.aws.amazon.com/thread.jspa?messageID=639931򜎻
Amazon Mobile Push can send notifications in two ways :
Push notifications for a single device with Application single end- point ARN
Send a message to SNS topic and that topic pushed to all subscribed endpoint devices
So, better to use SNS Topic if you need to broadcast same message to multiple users device or, there is a other way to do it by using end-point ARN also. Simple you need to maintain all users information in your database and just trigger message by fetching all members from database and push message one by one to all members.
EG :
$users = all users information having user info and ARN
registered with SNS applications ARN;
foreach ($users as $user) {
//Call AWS SNS pushed code with user's end-point informations, It will
//automatically send all subscribed users in present in your database
//tables also with proper informations
}
I am trying to develop an android app that verifies a transaction initiated from a browser on a PC. I want the server application to push a notification of a new transaction to the app so the user can confirm to complete the transaction. The tricky bit is the transaction is specific to a particular person (I'm using this as an alternative to sending an SMS for example). Can anyone help on how to go about this? Is it possible to do this with C2DM or GCM?
Using Android GCM is advisable. The complete reference to GCM is available at
http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/
Step by step GCM development is given in there. It is really very helpful. Hope this is helpful to you.
The critical thing you need to keep in mind before making a decision is that when you are using GCM, you need to keep a track of the users by keeping their GCM_ID in your database. You can add a gcm_id column to your users table for this and whenever the user opens your app, the gcm_id should be updated in your database. The gcm_id of the user's phone can change, from the official docs:
Note that Google may periodically refresh the registration ID, so you should design your Android application with the understanding that the com.google.android.c2dm.intent.REGISTRATION intent may be called multiple times
GCM push notifications wont be able to reach your users mobile phone all the time,especially if his phone is not connected to internet or switched off.You are using this for transactions etc, so I assume that the notifications must not fail. You should keep a check in your web application to send an SMS or notify the user that this has failed. You should get a response from GCM to your server through which you can identify a failed case.
Is possible to send an iOS push notification to a specific device? I've built a forum type app which the user can create a question and other people can answer it. I need to send an iOS Push Notification to the specific user which asked the question informing them that the question was answered. Is this possible to be done through PHP or another method?
Yes, you can absolutely send a push notification to a specific device.
First you need to ask the device for permission to receive push notifications:
[[UIApplication sharedApplication]
registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeSound |
UIRemoteNotificationTypeAlert)];
Then if the user accepts you will receive the delegate message didRegisterForRemoteNotificationsWithDeviceToken. You then pass that deviceToken to your server with the user Id from your app that identifies the user in your forum. Something like this:
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)_deviceToken {
NSString* deviceToken = [[[[_deviceToken description]
stringByReplacingOccurrencesOfString: #"<" withString: #""]
stringByReplacingOccurrencesOfString: #">" withString: #""]
stringByReplacingOccurrencesOfString: #" " withString: #""];
//send deviceToken and your userId to your server to associate the two together
}
Then you need to build your push server which sends the notifications, which I won't get into here as there is a ton of documentation online for that and it is quite involved. You can also use third party services for this such as Urban Airship and StackMob.
When you send push notification, the device gets an unique ID which you use to send to Apple to tell them whom to deliver the message to.
When you get this unique ID you send it off to your server, when you do that you can include any other data such as username, refs ect.
Its more of a server-side issue than an iOS issue.
Mateus,
tl;dr: Yes, you can.
Since your forum app is written in php, here are some frameworks that may be useful to you:
http://www.easyapns.com/
http://code.google.com/p/apns-php/
If you end up using Easy APNS:
You can send messages to a single user (like in your example), or to a group of users (maybe everyone who is "watching" that thread) using an array of user identifiers. Quite a few examples are available here: https://github.com/manifestinteractive/easyapns/blob/master/src/php/samples.php
Sure, there are a lot of free Push Notification servers - for example QuickBlox
You don't need any server code, QuickBlox already wrote all for you.
Just look at Push Notifications iOS sample - This sample enables you to send notifications and alerts to particular user or group of users at any time through an API or easy-to-use admin panel.
Just download it, move some code from it to your app - and enjoy it.