I am new to Facebook development and I am wondering how I can delay execution of an app notification by a given amount of time (days)?
At https://developers.facebook.com/docs/games/notifications or via Google I can't find anything regarding delaying notifications, everything seems to happen immediately.
What I am trying to achieve is that when a facebook app is loaded, I will add a notification to be executed in x days so that the user is reminded of returning to the app then.
I will do this every time the app loads, overwriting the existing notification that was still to be executed.
By that, the user will get the notification only when he really is not logged in for x days.
I'd like to solve that through Facebook alone and not through timers on the server. Can it be done?
There is no way to send delayed notifications, you need to do that on your own. For example, with a Cron Job that checks for the timestamp of the last login every day. Creating a new delayed notification (and deleting the old one) whenever the user logs in would be a weird solution anyway...Those things are usually done with Cron Jobs, there is no need to use the Facebook API when you donĀ“t need it.
Related
I have a problem with implementing multiple accounts in flutter app.
When the app is first opened, multiple network calls are made to get account related data. Those calls are usually made in initState of each widget using BLoC pattern. After await-ing on those data, UI or some other parts of app is updated.
The problem is, when user tries to switch to another account, app navigates user to the root page, so all the loading of required data for this account would happen again. But since some calls from previous account might still be ongoing and finish only after user switches to another account, I get multiple issues in application, like rendering UI with data that belongs to previous account.
I know I can dispose all those streams, so no UI is updated incorrectly regardless of the response. But, I was wondering if there is a way to kill all the ongoing requests, since app doesn't care about the response after the account is changed. In other words, I need the effect of restarting the app, but without actually restarting it. Is there any way to achieve that?
I have AoG action that is logging-in to external backend and once logged in it can control specific appliance via external backend's API. Action basically controls home alarm via commands like arm section XY, disarm section garage, etc. Before getting control to alarm it is necessary to login and this takes considerable time (approx. 20-30 seconds). This is much longer than AoG actually allows resulting in timeouts. I am initiating login as asynchronous operation in actions.intent.MAIN handler (i.e. not waiting for the result of login within handler) and just saying to user to tell the command (arm/disarm garage, etc.) in couple of seconds. I have also implemented push notification which is working fine. Problem with push notification is that it just pops up on mobile phone without any sound & user has to open notifications and tap it. Then it will trigger intent and do requested action.
This is not really good user experience (typically I would like to use my action in the car when coming home and having the possibility to disarm the home alarm without need to touch the phone, tap the notification, etc).
Any idea how to implement it in more proper way? What I would really appreciate is if google assistant could actually re-initiate the conversation & tell me something like: 'hey I am already logged in into alarm service provider, what do you want me to do now?'.
I will be grateful for any advice dealing with similar problem.
I am using ActionsSDK for Node.JS to build my action.
You've already looked at the ways that the Assistant can initiate (or re-initiate) a conversation. Actions are really designed for something that is conversational, and a 30 second pause in the conversation would be awkward.
One other option you have is to use a Media Response as part of your reply to the user logging in (or as part of your welcome intent? Not entirely clear, but the approach would be the same). This would let you play some "hold music" for several seconds. At the end of the music playing, an actions.intent.MEDIA_STATUS would be sent to your Action, which you can use to make sure the login has completed and, if so, respond to the user appropriately.
The only way for AoG to "take initiative of starting a conversation" is through push notifications. There is no way for the assistant to strike up a conversation after a period of time or when an event occur.
Perhaps another way of doing might be to only send push notification if your action fails to execute the long sequence of events and the triggering action could invoke an intent to try again. The assumption would be that everything's fine unless said so.
You could also notify the user that it'll take a couple of seconds to complete the action once it's initated and implement followup intents that handles if the user asks "Is it done?" or "How's it going?". Making it part of the flow to check on progress, but with the assumption that it should be successful.
You can easily dislocate the long running background process by implementing a task queue in Firebase where your intent is creating a child similar to this.
firebase.database().ref("tasks").push({action: "disarm_garage"});
And then you create a cloud function trigger to handle it
functions.database.ref('tasks/{id}').onCreate((snap) => {
const action = snap.val().action;
switch (action) {
case 'disarm_garage':
// ...
break;
}
// Remove the task after processing
return snap.ref.remove();
});
That would ensure that you have enough time to complete the task in background without blocking the conversation.
My Facebook app will send app-to-user notifications when certain events trigger. It works flawlessly most of the time.
The exception is if TWO notifications are triggered and sent to the same user at the same time. It's an uncommon scenario but what sometimes happens is this: only one notification preview appears on the bottom left and the other notification shows in the notifications dropdown. After a few seconds pass the preview disappears yet only one notification remains in the dropdown. One notification is now lost.
My API requests are done in batch and the results show success.
Again, this only happens occasionally - which is the part that confuses me most. I am having trouble debugging the issue because I see no signs of error on my end.
My best guess is that since the batch requests are for the same user at the same time, Facebook is somehow confusing or overwriting one. It seems odd, however, that both are shown inside facebook for a brief period (one in corner preview and the other in the dropdown) and then one is lost.
Has anyone seen this before? Any ideas or suggestions on how to troubleshoot this?
Thank you!
I am creating an application which has a follow mechanism where the followed user has to accept the request of a following (similar to private accounts on instagram).
I then want the following user to find out when the other user has checked a million times (every time the following user opens the screen if I did the query in viewDidLoad). However, the problem with this, is that there will be a lot requests which will expensive to me as I will have to pay for the requests to Parse so I want to minimise these queries.
Currently, the best thing I can think of is to check once a day at midnight for example but this doesn't seem very seamless.
Is there a better way of doing this?
For starters consider how stale you are willing to allow an app's view of the world to be and cache the response that long. If a user views that screen every 30 seconds you might only want to actually check with the server 5 minutes after the last successful response (or the last response which had 0 follow requests).
You might consider switching from this sort of "pull" polling where the client decides when to ask the server if anything has changed to a "push" model where the server can inform the client when a change occurs. For example you can send a silent background push notification to a user's devices when they have a follow request, the app can then respond by performing your existing query.
You might still want polling or user triggered requests (like a "pull to refresh" gesture) as a fallback for missed notifications or devices with notifications disabled but you should be able to drastically reduce request volume.
I have to implement In App Purchase Auto-Renewal Model in my app. I have created a test user and getting the response from App Store for subscription. When I tap "Confirm" then sometimes its state becomes SKPaymentTransactionStatePurchased and sometimes it becomes SKPaymentTransactionStateRestored. My problem is that I want to prevent user to use the app if he has not subscribed the app. For that I am trying to track the state of "SKPaymentTransaction" so that I can allow or disallow the user to use the app. Such that, if the state is SKPaymentTransactionStatePurchased, only then he could be able to use the app, but I don't understand how its state changes.
One more thing, When I tap on the "Settings" to manage my Auto-Renewal, it shows me that my app will be expired on the current date i.e., today itself, but when I tapped on the "Confirm" button to subscribe my app for one month then expiry date should be after one month. I don't understand how this whole process is working.
I have read whole documentation of Auto Renewal, but didn't get any help from that.
Please help!
Not sure about your first problem. In my case, I can never get SKPaymentTransactionStateRestored called at all. I am debugging why.
Meanwhile, I was facing the second problem you described. When I decoded the receipt, it looks like they keep the subscription valid for 5 mins. Sounds like a feature for testing in sandbox. At least that's what I am assuming.