BPGoogleDriveActivity is an iOS UIActivity subclass for uploading to Dropbox.
The structure of the pod is based on GSDropboxActivity but has been reworked for Google Drive.
To run the example project; clone the repo, and run pod install from the Example directory first.
BPGoogleDriveActivity is available through CocoaPods, to install it simply add the following line to your Podfile:
pod "BPGoogleDriveActivity"
#import <BPGoogleDriveActivity/BPGoogleDrive.h>
...
NSString *driveClientID = @"CLIENT_ID";
NSString *driveAppSecret = @"APP_SECRET";
NSString *driveScope = kGTLAuthScopeDrive;
BPGoogleDrive *drive = [[BPGoogleDrive alloc] initWithClientID:driveClientID appSecret:driveAppSecret scope:driveScope];
[BPGoogleDrive setSharedDrive:drive];
3. Add a BPGoogleDriveActivity object to your list of custom activities and share some NSURL objects
BPGoogleDriveActivity can share NSURL objects where each object is the URL of a file on the local disk.
- (void)handleShareButton:(id)sender
{
NSArray *itemsToShare = @[
// Your items to share go here.
// BPGoogleDriveActivity can share NSURL objects where each object is
// the file URL to a file on disk.
];
NSArray *applicationActivities = @[
[[BPGoogleDriveActivity alloc] init]
];
UIActivityViewController *vc = [[UIActivityViewController alloc] initWithActivityItems:itemsToShare
applicationActivities:applicationActivities];
// Present modally - suitable for iPhone.
// On iPad, you should present in a UIPopoverController
[self presentViewController:vc animated:YES completion:NULL];
}The following notifications are declared in BPGoogleDriveUploader.h:
Fired when a file starts uploading.
userInfo dictionary entries:
BPGoogleDriveUploaderFileURLKey: the URL of the file being uploaded
Fired when a file finishes uploading.
userInfo dictionary entries:
BPGoogleDriveUploaderFileURLKey: the URL of the file being uploaded
Fired periodically while a file is uploading.
userInfo dictionary entries:
BPGoogleDriveUploaderFileURLKey: the URL of the file being uploadedBPGoogleDriveUploaderProgressKey: the current upload progress; anNSNumberwhosefloatValueis between 0.0 and 1.0
Fired when a file fails to upload.
userInfo dictionary entries:
BPGoogleDriveUploaderFileURLKey: the URL of the file being uploaded
Jeffrey Sambells, bp@tropicalpixels.com
This work is licensed under a Creative Commons Attribution 3.0 Unported License.
You're free to use this code in any project, including commercial. Please include the following text somewhere suitable, e.g. your app's About screen:
Uses BPGoogleDriveActivity by Jeffrey Sambells based on GSDropboxActivity by Simon Whitaker


