I am writing an app for iOS using dropbox Api.
My app has the following features,
1. User must be able to log in to his dropbox account, create document and upload.
2. He must be able to view his folder and file contents.
3. User must have the provision to share the documents with others.
I have completed the first 2 tasks, but finding it difficult to share the documents. I have referred dropbox developers forum but didn't get any solution.
Can anybody please tell me how do I do this?
Thanks in advance.
You can make a call to:
NSString *path = #"/yourfile.jpg";
[[self restClient] loadSharableLinkForFile:path];
Then you set up the delegate methods:
- (void)restClient:(DBRestClient*)restClient loadedSharableLink:(NSString*)link forFile:(NSString*)path
{
NSLog(#"link is %#", link);
}
- (void)restClient:(DBRestClient*)restClient loadSharableLinkFailedWithError:(NSError*)error
{
NSLog("%#", [error localizedDescription]);
}
You can find all the calls you need by looking inside the framework at DBRestClient.h.
Good luck!
The Dropbox API provides the /shares call ( https://www.dropbox.com/developers/reference/api#shares ) to allow you to create read-only shareable links ( https://www.dropbox.com/help/167 ) to any file or folder in the user's Dropbox. This call is available via the loadSharableLinkForFile: function in DBRestClient.m in the official Dropbox iOS SDK. (The Dropbox API does not currently offer any calls for read/write shared folders.)
Related
I'm trying to create new DropboxPaper document in my account [email address redacted],
I'm use official Api and try to create file by "https://api.dropboxapi.com/2/paper/docs/create", the returned result is:
{
"error_summary": "insufficient_permissions/.",
"error": {
".tag": "insufficient_permissions"
}
}
Somebody know what's is wrong? Please help me)
[Cross-linking for reference: https://www.dropboxforum.com/t5/API-Support-Feedback/Paper-API-Create-Paper-Document/m-p/375961/highlight/true#M21093 ]
It sounds like you're probably using a new Dropbox account, so the Dropbox Paper functionality is only available in the Dropbox filesystem, and not via the legacy Paper API endpoints. You can find more information here:
https://www.dropbox.com/lp/developers/reference/paper-migration-guide
I want to get all wall updates of user's google plus account like facebook.
I have seen official link for it which is
Google Plus Documentation for iOS
& I have downloaded sample from there which is here Google Plus SDK Sample
it works well for getting user's information like email id,profile name,user's friend list with images & for posting on google plus.
but I am not getting user's post & updates.
all I want is user's wall updates & user's friends updates from google plus like facebook does.
but from above link i have found nothing for getting wall updates.
I have searched google for this also & get nothing regarding above problem.
any help for above problem appreciated.
Thanks in advance
From a backend server you can easily perform this API call to read a user's public activities. You can see the REST API here:
https://developers.google.com/apis-explorer/#p/plus/v1/plus.activities.list
Combine this with a people.list and you can query for a user's friend activities on Google+.
On iOS, you probably don't want to make these API calls directly from a user's device. If you can, you should offload the work to a backend server to avoid overworking the mobile client. That said, you can perform an API query similar to listing people in circles:
GTLQueryPlus *query =
[GTLQueryPlus queryForActivitiesListWithUserId:#"me" collection:#"public"];
[[[GPPSignIn sharedInstance] plusService] executeQuery:query
completionHandler:^(GTLServiceTicket *ticket,
GTLPlusActivityFeed *actFeed,
NSError *error) {
}
If you put a breakpoint in the application on the function, the activities feed will be something like as follows:
(lldb) po actFeed
{
nextPageToken:"CAIQ44qZ58DgtwIgFCgB"
etag:""DOKFJGXi7L9ogpHc3dzouWOBEEg/UMVQXfw8ynZaTz31tpuZo473TsQ""
title:"Google+ List of Activities for Collection PUBLIC"
updated:"2013-07-16T04:04:34.697Z"
kind:"plus#activityFeed" items:[20]
}
The items array contains the actual activities that a user has publicly written on Google+.
I have been searching for tutorials on google for posting some text on google plus. But it seems like there are none.
I have also tried to go through the docs provided by google for developers of mac and iPhone but can't find anything that will solve my problem. Also there are little information on how to get the user login to there google plus account.
I am not sure what to do for the user login, do I have to use some GTLObject or use UIWebView like foursquare for user login.
Here is a list of docs that I had went through.
http://code.google.com/p/google-api-objectivec-client/wiki/Introduction
http://code.google.com/p/google-api-objectivec-client/wiki/BuildingTheLibrary
http://code.google.com/p/gtm-oauth2/
As it turns out there are only a limited number of api's available for google + developers and that also only as GET calls according to the developer of google + page my question will not get any definite answers as google is in the process of creating new api's for accessing user information on google plus.
https://developers.google.com/+/api/
Also you can use the google client sdk provided by google but it is much easier to show a webview for user login. I managed to get the people list from google plus.
The steps are same as for getting the access token as in foursquare. Just with some small changes.
in viewdidload method.
NSString *authStr = #"https://accounts.google.com/o/oauth2/auth?client_id=client_id&redirect_uri=http://somevalidurl.com&scope=https://www.googleapis.com/auth/plus.me&response_type=token";
as a url for loading request in webview. People should note one thing here that you need to create a client id in api console for your app that is web based and not as installed for this purpose as you wont we getting any option to enter any website url for callback which is very important in this case.
and in webview delegate method webViewDidFinishLoad:
NSString *urlStr = [[webView.request URL] absoluteString];
NSArray *array = [urlStr componentsSeparatedByString:#"access_token="];
if(array.count > 1)
{
NSString *oauth_token = [[[array objectAtIndex:1] componentsSeparatedByString:#"&"] objectAtIndex:0];
//do something with the oauth token after this.
}
I wrote a code snippet to signin and post simple text to Google Plus with URL and thumb Image URL.
Try it
Take a look here:
http://code.google.com/p/google-api-objectivec-client/source/browse/#svn%2Ftrunk%2FExamples%2FBooksSample
http://code.google.com/p/google-api-objectivec-client/
It looks like Twitter registers the URI scheme of twitter://, but after playing around with it I can't get it to directly open a user's profile. I've tried:
twitter://username
twitter://user/username
twitter://profile/username
with no luck. I'll need it to work on Android as well.
Thoughts?
I found two URL schemes for twitter tweetie:// and twitter://:
tweetie:///user?screen_name=jessicaalba
twitter:///user?screen_name=jessicaalba
On this wiki site you can find a lot of other iphone url schemes (including twitter)
Doesn't seem to be official documented anywhere so I wouldn't count on all versions of the Twitter app supporting it but http://groups.google.com/group/twitter-development-talk/browse_thread/thread/92b958b7af002993?pli=1 gives a hint that might be worth a try:
I just found that "twitter:///user?screen_name=tvdw" works as well.
I know you are looking specifically to open it up with the official Twitter app but what if the person doesn't have the app, then the functionality will not work in your app.
Why not just use MGTwitterEngine in this case since it will work for everyone and it will remain in your app?
For those wondering how to test if the scheme executes:
- (BOOL)openURL:(NSString *)url
- (void) clickTwitter {
if (![self openURL:#"twitter:///user?screen_name=mufumbo"]) {
if (![self openURL:#"tweetie:///user?screen_name=mufumbo"]) {
[self openURL:#"http://twitter.com/mufumbo"];
}
}
}
you can include many more and make it a generic loop.
I want to open iphone apps like Contacts and Calendar from within my phonegap app, I don't mind that doing so will put my app in the background. I can open the browser and using window.open but how do I open other apps?
eg window.open("contacts://", '_blank'); doesn't work
The only way that one app, PhoneGap-based or otherwise, can cause another app to launch is to open an URL that uses the target app's custom URL scheme. So, if the Contacts app supports some custom scheme, you're in luck. If not, you're out of luck.
You are going to need to write a custom phonegap plugin so that you can access custom methods you write in objective C.
The official phonegap documentation is here.
I'll briefly explain how you will do this.
In your javascript you will call this code :
PhoneGap.exec("OpenMailAppPlugin.openMailApp",parameter1);
In objective C you will create a new file OpenMailAppPlugin class. Read the link above for exact instuctions, but the important method will be soemthing like this.
-(void) openMailApp:(NSMutableArray*)paramArray withDict:(NSMutableDictionary*)options {
NSString *parameter1 = [paramArray objectAtIndex:0]; //recieves information from javascript function
NSURL* mailURL = [NSURL URLWithString: #"mailto:%#?cc=bar#example.com&subject=Greetings%20from%Cupertino!&body=Wish%20you%20were%20here!",paramter1];
[[UIApplication sharedApplication] openURL: mailURL];
}
additionally, you may be interested in sending information back to your phonegap application. You can do this by injecting a javascript call that sends parameters. In your objective C function you would do something like this.
NSString * jsCallBack = [NSString stringWithFormat:#"myJavascriptFunction('%#');",parameter];
[self.webView stringByEvaluatingJavaScriptFromString:jsCallBack];
As previously answered, using a URL scheme can work. If you have several apps and you want to be able to open one from the other, then it's really simple when using PhoneGap build: you just need to add the URL scheme to your config.xml file, eg:
// In config.xml
<gap:url-scheme>
<scheme>app1scheme</scheme>
</gap:url-scheme>
Then from your other app you'll just have a link to app1scheme://, eg simply
Start App1
Here is the list of all the iOS/iPhone app url
Video - video:
Music - music:
Youtube - youtube.com
iTunes store - itms:
iBooks - itms-books:
App Store - itms-apps:
Mail sending - mailto:
Telephone - tel:
More can be found at this outdated link
http://www.wiki.akosma.com/IPhone_URL_Schemes
Look at this on how you can implement your's url
https://appurl.org/docs-handling-android
Need to use a plugin, unfortunately you need native ios code:
This one works:
https://github.com/phonegap/phonegap-plugins/tree/master/iOS/ExternalFileUtil