google calendar api - change web_hook address for an existing push notification channel - oauth

Our site has a calendar sync feature with google calendar using google calendar api, and their push notifications service. so far so good, users are happy with the feature. and we're happy they're happy:)
Recently we decided to add a sub domain to the server handling google notifications (for none related reasons)
so it is changing from http://example.com to http://api.example.com.
THE PROBLEM we cant find a way to replace the domain address for the existing users channels.
Any Suggestions?
Thanks.
PS - i'm aware of the security issue, after all the users authorized http://example.com and not http://api.example.com. but still we need to free http://example.com for other matters.

You are going to have to stop the original one and start a new one. I dont think there is anyway to updated it. Its actually documented that its not possible to renew them so that would make me think its not possible to update them at all Renewing notification channels.

Related

How to share links via FB App when I am offline

I am developing an mobile app for iPhone. The app will primary used by people who are on holiday in a different country and will be offline most of the time, due to high costs for internet traffic.
However, the company for which I am developing the app wants to users to be able to use the "Facebook Share" functionality also when people are not connected to the internet.
It should work on a way that they click the SHARE link button in the app, but then get a message that they are offline and the link will get shared as soon as they are online again.
I am trying to figure out how to do this. Can I pass the link I want to share to the official FB App via fb:// protocol (or whatever) and the FB App handles the post/share as soon as it is online again?
Or do I have to do it on my own, put the links I want to share in a internal database and then post them to the wall when I am online again?
Or any other ways??
Any suggestions would be welcome, I would prefer a very quick solution and hope someone maybe has an idea how to do this. I was hoping I can pass the share-link to the official FB App and this one handles everything when it goes online again !?
Thanks for your ideas!
Your approach should be to make your link-sharing code automatically cache requests until they are sent. The app then doesn't need to concern itself with the details - it can just post the link and get a 'failed', 'success', or 'postponed' response from your API and notify the user accordingly.
Your link-sharing code can then internally check if it can currently post to FB and if not (either because the user is currently offline or perhaps the Facebook token is expired) it will store it for later. This class will then re-check periodically (for example when the app comes to the foreground or when the class is initialised the next time the app starts) for connectivity and then it will check if the token is still valid and perform FB login if required. Once it has a valid token it can then iterate through the pending requests and act upon them.
If you really want to make it nice and clean, you can separate out the code that accepts incoming requests to do something, checks if it can be performed now, does it or stores it for later, and periodically checks any requests in the pending queue. This class will not have any idea what the requests do or how they are performed, it will work with another class that implements a protocol to do the actual work and knows about facebook, etc. There may even be an existing design pattern for such a setup, but I don't know what it's called if there is.
Update: I did some research and found this is very similar to the "Fire-and-Forget Pattern".

is there support to mark events as read-only either in CalDAV or ical (icalendar)

I've searched the iCalendar spec https://www.rfc-editor.org/rfc/rfc5545 and the CalDAV spec https://www.rfc-editor.org/rfc/rfc4791 looking for insight on how to mark an event that is sent from our calendar server to an iPhone as "read-only" (non-editable) when the iPhone connects to our server using the CalDAV protocol. But the answer is not jumping out at me.
In other words, the iPhone user is receiving, via a CalDAV account a bunch of events. Normally, they can edit any of these events. However, we want to be able to mark a few as read-only. I know that we can use the iPhone ability to add an .ics subscription account, but we don't really want to do this, because it requires the iPhone user to add BOTH a CalDAV and an .ics subscription account.
We are using SabreDAV as our CalDAV server.
My technical co-worker has asked me to look into this, so I am asking for help from the Stackoverflow community.
Any help or hints will be greatly appreciated.
Once you've sent the file to the user it's theirs to deal with so...
I would say there isn't a way to protect the appointment/event from modification.
What you can however do is host the whole calendar yourself and if the user has Outlook or similiar, to subscribe to that RSS feed.
It's one idea... but for protecting what you send them? Highly doubtful. Just take heart they are only modifying their copy of your data, not the source data itself.
1/ You can use shared calendars and invite the user as a read-only. However, the user will have 2 calendars: its own and the shared calendar. Still, it's the same CalDAV account so the user has just one checkbox to click to opt in.
2/ I've not tried ACL but maybe you can play with it.
3/ As a dirtly last resort, you can edit Sabre\CalDAV\Backend\PDO::updateCalendarObject and deleteCalendarObject and add your conditions. But that's very low-level at this point (this class doesn't even know who's doing the change). I don't recommend it.

In Newsstand app how do I find a list of devices that are subscribed?

I can't afford UrbanAirship so I'm trying to program the server side of a Newsstand app myself.
I plan on using the JavaPNS API.
The one thing I can't seem to figure out is how to find a list of users who have a subscription in my app.
Can I query this information from Apple some how?
If I can't then I guess that means that each time a user subscribes they send their device token directly to my server. I hope this is not the case because I was hopping to run the server on my laptop and send out pushes myself without having to keep the laptop running all day listening for new subscribers.
Thanks!
Looks like I do need to register each device with my server: http://www.ibm.com/developerworks/web/library/mo-ios-push/index.html#resources
You kind of found your answer but just in case you really need a server for not only handling the push notification (for telling your app in Newsstand to check the new issue and download it in the background) but also for subscription and in-app purchasing.
Every time you launch the app you should check few things before you refresh the UI. You should check if the user is a subscriber or has user already bought the issue so you can show view/download button instead of Buy button.
Check out these tutorials if they help to understand these communications better but believe me you will end up with one of those services like Urban Airship (Which I think UA is the best option because it handles all in one not just push notification):
http://ios-blog.co.uk/tutorials/how-to-make-a-magazine-app-in-ios-part-i/
this one is more focus on server part:
http://ios-blog.co.uk/tutorials/how-to-make-a-magazine-app-in-ios-part-ii/
http://www.viggiosoft.com/blog/blog/2011/10/17/ios-newsstand-tutorial
http://www.raywenderlich.com/2797/introduction-to-in-app-purchases
And as always this is the best place for start (it has everything you need):
https://developer.apple.com/devcenter/ios/newsstand/
These are some resources to help you in developing app for Newsstand but still there are not enough people out there to share their experience.
Best of luck.
Edit: Add these two links two this list:
http://www.marco.org/2012/10/11/the-magazine
http://www.marco.org/2012/12/12/the-magazine-future-of-publishing

How to Add Phone With twitter using Third Party tool

I need a script that will add my phone with Twitter for All latest notification.
I found this page Twitter but i need to create script for my own application.
I goggled but i didn't get any solution For this.Please Help me to find this answer.
Thanks a lot in advance.
First Edit
This is a twitter's new feature Send notification to Phone. Actually I want to create an app that will allow users to register there phone with twitter via my application. Ie I need a script to implement send notification to phone.
The question that others are asking you Pankaj is what platform is your application being written for. You keep saying you want a "script" to do this, but what kind of script?
Giving us more insight to what your application is (a console application written in C#, or an ASP.NET web application) would lend more detail and raise the chances of someone being able to help you. :)
Regardless of your app's platform though, you're probably going to need to look into the Twitter API for setting this up. This is the normal method to interact with Twitter from 3rd party applications. So all the suggestions above, specifically the list of API's available, is probably what you're looking for.
Hey, can you give some more information? What kind of Phone are you developing for?
Maybe that helps solving your Problem.
If you are just searching for a way connecting your Phone to Twitter, here is the Twitter FAQ for Phone connecting:
http://support.twitter.com/articles/14014-twitter-phone-faqs
Maybe it helps, or give you more keywords for your search.
I don't believe there's a way to get or set the notification phone number using the API, however if a phone is already setup on the profile you want to configure, you can do the following to get notification from all user friends.
The user will need to authorize your application to access her account. This flow uses OAuth, and begins here:
http://api.twitter.com/oauth/request_token
Once the user has granted your app access, and your application has all the required OAuth credentials, turn on notifications using account/update_delivery_device:
http://api.twitter.com/1/account/update_delivery_device.json?device=sms
Next, fetch all the IDs for your user's friends using the friends/ids API call. Be sure to study the documentation; this call uses cursors, so you will have to manage those if the user has over 5,000 friends. Store these IDs for use in the next step. Here's an example call:
http://api.twitter.com/1/friends/ids.json?cursor=-1
Once you have all of the friend IDs, you can call notifications/follow repeatedly to enable notifications on your mobile device whenever your friend makes an update:
http://api.twitter.com/1/notifications/follow.xml?user_id=12345
This approach will burn one API call for each user that you enable notifications for; there's no way currently to manage notifications en masse.

Send Facebook notification to user who registered on my site via facebook connect

Let me start by saying facebook's developer documentation sucks. Bad.
I'm using the facebooker plugin in rails to let users sign up through facebook connect. Now when certain things occur I want to send notifications to certain users through facebook. I heard some say that notifications must go from one user to another, but I've seen evidence otherwise. I signed up at the site http://www.meetingwave.com/ through fb connect, and now they send me (annoyingly) daily notifications of new things on their site. Also, using the comments widget on my own site www.tmatthew.net, when an anonymous user leaves a comment I get notified of that as well.
So uh, how do you do that? I've been googling all week long and can't seem to find anything. It seems like I should be able to send a notification from my app to one of it's users.
The api call you are looking for is called Notifications.send. The only thing is that they will be disabling it very soon so there is probably no point in implementing it into your application.

Resources