I'm working on an app that uses the Square API to react to Point-of-sale events. For example, a customer goes to a take-out restaurant. The restaurant uses Square to accept payments. The customer pays cash. At that point, Square sends a notification to a custom webhook with the PAYMENT_UPDATED flag. Then, the app I'm working on should send a push (APNS) notification to the device that just accepted the cash payment.
The problem is that I haven't found a way to single out a particular device within a Square location. So what ends up happening is that all devices registered to a Square account get the push notification.
The user registration workflow is as follows:
A business launches the app and gives permission to receive push notifications (this is where we get and save the device token).
The business registers for an account.
The business authenticates with Square (allows our app to receive Square notifications).
I feel like there should be a way to associate a device token used for APNS with a device ID linked to a Square Location (and subsequently accessed via Square's Location API), but I haven't been able to figure it out.
Any thoughts or suggestions? Thanks!
UPDATE
The code isn't really the issue. By that I mean whether we're using PHP, Java, Ruby, etc, the issue remains the same. The only solution I can think of would be to use Square's SDKs to build a completely custom POS system, but that'd be like using a sludge hammer to put a tac in a wall.
The ultimate goal is to simply create a relationship between a Square device and a user's device I have stored as a record in my sql database. Seems like it should be straight forward, but not so much.
Related
I've been following this tutorial and have reached the point where I am able to receive push notifications (only working with android for now). My code is almost identical to the tutorial's. I'm now looking to expand the functionality. In the tutorial, when the app receives a RemoteMessage object, it parses out the "action" value from the data. It then passes that string to the NotificationActionService which triggers an action.
public override void OnMessageReceived(RemoteMessage message)
{
if (message.Data.TryGetValue("action", out var messageAction))
NotificationActionService.TriggerAction(messageAction);
}
The downside to this is that the only information it passes to the rest of the program is the name of the action. I want to add additional information. I would usually just add another parameter to the TriggerAction method, but the implementation of INotificationActionService is pretty involved. I'm wondering if its like that for a reason, or if I can just process my message in the OnMessageReceived. What makes me hesitant to change this is that the this action string is also pulled from the Intent on start up, and I'm not sure if if this will break it. I'm not entirely sure how android intents work, but both the RemoteMessage and the Intent would require this extra data inside the dictionary.
So, what is the best way to modify this tutorial to allow extra context to be passed in the push notification?
This is a good question - and realistically there isn't really one answer. Basically, all Android applications are going to be a collection of Activities and Services. You can think of them like independent threads that the OS is aware of and can help manage. Intents are a standardized way to communicate between these threads using a small set of types that are safe to serialize, so the OS can make stronger guarantees about the how and when it'll be delivered. There's a lot of documentation, and a whole world of different ways to architect your application with these. Each approach will have pros and cons, with some options being way too sophisticated for some applications, and others way too simple.
The Xamarin sample you're referencing keeps two separate threads: one for receiving remote notifications and one for rendering notifications. In principle, a developer may do this to allow notifications to be rendered in response to a message from a remote service OR in response to events local to the phone. For instance, my banking app alerts me that I'm being logged-out after 15 minutes of inactivity, and also when new tax documents are available. The first scenario is best served locally, where a notification will be rendered because a timer reached 15 minutes without being reset. The second scenario is better served by a remote notification so the app doesn't need to poll for new documents.
Bottom line - the sample app may be using an approach that introduces more overhead than your scenario calls for. For others it will be too simple. Choose what is right for your application.
Our site enables users to send money to us via a bank transfer. They 'initiate' the transfer and get a reference code. Then they log in to their bank account and send the money using the reference code.
We track when a user promises to send the money but I'm not sure how to track when that money arrives. They won't be logged into the site when it happens which makes it complicated. Is there a way to do this?
Thanks in advance!
It is possible to track events on behalf of a recent user, but it requires coding on server side. You need to use the Google Analytics Measurement Protocol
to create this event, when you are notified about a successful transfer. You can send all relevant information to Google Analytics, like event category, action, or event value (e.g. transfer amount), or even track these as ecommerce transactions.
You can check the parameter reference to learn about the required and optional parameters to be sent with your hit. You can also experiment with such custom built hits with the Hit Builder tool.
If you would like this event to be connected to your existing user, then you'll also need to store your visitor's client ID during their visit, and later reuse this client ID in your backend-initiated Analytics hit.
Here is an example for an event hit for a recently stored ClientId, with given event attributes, including value.
There a few things to be considered in such scenarios, or at least to be aware of. Such events will generate additional hits in your Analytics property, and also initiate sessions, which can alter your various Analytics metrics, if their volume is comparable to your overall traffic.
I am trying to introduce a messenger (chat) feature in my application.
I ma unable to figure out how to make the feature sync on multiple devices.
Let's say I am using the chat on my phone, and then I login to my desktop and start chatting there. How would I get the messages on both devices and how will both be in sync with each other. Additionally, for the sender to get a read confirmation, the message should be read from either one of the device, but the notification of unread should be shown on sender's device on which the message in unread unless he opens and reads it.
For First Part of the question you want to do Like FB Messenger where you loggin you will find your whole messages found not related to a device. To Achieve that you can have at the device app Last Login time which will be posted to the server, and all messages from that time will be retrieved to the user. But imagine the user has read all his messages from the mobile but he didnt open the computer since one Month. IF you didnt mark the message as read, he will find enourmous amount of messages coming as unread but he actually read on his mobile which will cause you huge usability issue.
For your Case I feel you need to do exaclty what FB Messenger does. Retrieve your latest messages from your conv with their actual status. And while scrolling up load by demand.
So Your Message will have only 1 Status(Read or UnRead) And date where you can match with Device Last Sync time.
I'm new comer in mobile value added service field. I searched & read other company's presentation for mobile value added service with sms platform. But I can't find the right way. I don't know where to start, which platform or server should use for it. I will explain road map first. I will provide content with sms. If you wanna get the contents from me, you need to subscribe first. Then, I will sent contents to all subscribed numbers daily. Then, I will charge for content daily. Please help me which platform or server should I use?
You can use a short code for that, in which country are you in?
I have a problem and i think its have to do with sessions. (at least i want it to be related to sessions because i need to use sessions),
Suppose i have a list of names of people logged in, on my site .
I want that once i press someone's name, that he and I will get a game board. (No confirmation at the moment ..).
Now how do i get the game board , it's obvious. but, how to make that the other user will get one .. ?(the user that i chose from the list).
The other user, he is like a passive user, he suddenly getting a game board.
someone understands?
Thanks in advance .
Seems like you need some COMET/push technology. You may take a look at SignalR which would allow you to push contents to specified clients. Basically all clients will subscribe to notifications from the server and when a particular request comes from an administrator you could then send notification to the selected clients.