Showing posts with label 5. Show all posts
Showing posts with label 5. Show all posts

Thursday, March 12, 2015

5 things you didnt know you could do with the Google Drive API

Have you tried using the Google Drive API? If so, you’re aware that it allows you to programmatically manage a user’s Google Drive and build applications to manipulate files stored in the user’s account. However, the API might still be capable of doing a few things you didn’t know about. Here is a list of five specific use cases and how each of them can be addressed with the API.

1) Sharing a file with the world

When a file in Google Drive is shared publicly, it can be downloaded without authentication at the URL provided by the API in the webContentLink field of the Files resource. To retrieve that value, send a GET request to retrieve the file metadata and look for the webContentLink element in the JSON response, as in the following example:


{
"kind": "drive#file",
"id": "0B8E...",
"etag": "WtRjAP...",
"selfLink": "https://www.googleapis.com/drive/v2/files/0B8E...",
"webContentLink": "https://docs.google.com/a/google.com/uc?id=0B8E...",
...
}

2) Granting comment-only access to a user

When setting permissions for a file with the Drive API, you can choose one of owner, writer and reader as the value for the role parameter. The Drive UI also lists another role, commenter, which is not allowed for that parameter.

In order to grant comment-only access to a user with the Drive API, you have to set the role parameter to reader and include the value commenter in the list of additionalRoles, as in the following example:


{
"kind": "drive#permission",
...
"role": "reader",
"additionalRoles": [
"commenter"
],

...
}

3) Listing all files in the root folder

It is possible to restrict the list of files (and folders) returned by the Drive API by specifying some search criteria in the q query parameter. Each file has a parents collection listing all folders containing it, and the root folder in Google Drive can be conveniently addressed with the alias ‘root’. All you need to do to retrieve all files in that folder is add a search query for element with ‘root’ in their parents collection, as in the following example:


GET https://www.googleapis.com/drive/v2/files?q=root in parents

Remember to URL-encode the search query for transmission unless you are using one of the available client libraries.

4) Finding how much quota is available in the user’s account

Your application might need to know if users have enough available quota to save a file, in order to handle the case when they don’t. Quota information is available in the About feed of the Drive API:


{
"kind": "drive#about",
...
"quotaBytesTotal": "59055800320",
"quotaBytesUsed": "14547272",
"quotaBytesUsedInTrash": "511494",

...
}

The feed includes three values related to quota management: quotaBytesTotal, quotaBytesUsed and quotaBytesUsedInTrash. The first value indicates the total amount of bytes available to the user (new accounts currently get 5GB for free) while the second one tells how many of those bytes are in use. In case you need to get more free space, you can use the last value to know how many bytes are used by files that have been trashed. An application might use this value to recommend emptying the trash bin before suggesting to get additional storage.

5) Discovering if one of the user’s apps can open a file

Google Drive allows users to store any kind of file and to install applications to open file types that are not directly supported by the native Google applications. In case you need to know what applications are installed and what file types each of them can open, you can retrieve the Apps feed and look for the primaryMimeTypes and secondaryMimeTypes elements for supported MIME types or primaryFileExtensions and secondaryFileExtensions for file extensions:


{
"kind": "drive#app",
"name": "Pixlr Editor",
...
"primaryMimeTypes": [
"image/psd",
"image/pxd",
"application/vnd.google-apps.drive-sdk.419782477519"
],
"secondaryMimeTypes": [
"image/png",
"image/jpeg",
"image/gif",
"image/bmp"
],
"primaryFileExtensions": [
"pxd",
"psd"
],
"secondaryFileExtensions": [
"jpg",
"png",
"jpeg",
"bmp",
"gif"
],


}

Note: to access the Apps feed you have to request access to the https://www.googleapis.com/auth/drive.apps.readonly OAuth scope.

Claudio Cherubino   profile | twitter | blog

Claudio is an engineer in the Google Drive Developer Relations team. Prior to Google, he worked as software developer, technology evangelist, community manager, consultant, technical translator and has contributed to many open-source projects. His current interests include Google APIs, new technologies and coffee.

Read more »

Thursday, January 22, 2015

how to install IOS 7 on iPhone 4 4s 5

How to install IOS 7 on iPhone 4 ,4s,5



You should  always perform a backup before applying any major new firmware release. If you back up your devices to iCloud or sync with iTunes via Wi-Fi, temporarily disable both options.
To disable iCloud backup, toggle the iCloud Backup switch to OFF under iOS Settings > iCloud > Storage & Backup. To disable iTunes Wi-Fi sync, tether the device to a Mac or PC via a USB cable and uncheck the “Sync with this iPhone over Wi-Fi” box under your device’s Summary tab in iTunes.
iTunes-11-Welcome-to-your-new-phone



Make sure you’re running the most up-to-date version of iTunes (you should only download the latest version of iTunes from Apple’s website). Fire up the program and choose your device in the upper right part of the iTunes window. Should iTunes warn you there’s a new version of iPhone firmware update available, just cancel the prompt.

itunes11
Click on the device’s name in the upper-right part of the iTunes window, navigate to the Summary tab and hit the “Back Up Now”. Fix yourself a cup of coffee as creating a backup on your computer may take a while, depending on its contents and storage capacity.
iTunes-11-Back-up-iPhone
While we’re at it, update your iOS apps by going to the Updates tab in the iTunes Apps section. Now’s also a good time to copy the device backup file to an external drive (PC) or initiate a manual Time Capsule backup. To do the latter, just choose Back Up Now from your Mac’s menu bar. If you don’t see the option, tick the “Show Time Machine in menu bar” box in System Preferences > Time Machine.
Screen-Shot-2013-09-17-at-22.19.11
To see where iTunes stores iOS device backup files on your computer, choose Preferences from the iTunes menu and navigate to the Devices tab. In case you were wondering, iOS backups keep all your app data and settings, sans your media and apps themselves because these items already exist in iTunes/iCloud.

Keeping a device backup on your computer is not only a precautionary measure, it’ll also speed up restoring your device should you encounter any issues – as opposed to restoring from an iCloud backup.
iTunes-11-Restore-iPhone
You’re now ready to install iOS 7: hit the Restore iPhone button in iTunes and wait until the software downloads and verifies the latest iOS 7 build with iOSDownload.
Read more »

Sunday, January 18, 2015

Leaked Nexus 5 Smart Phone Specification Review

Leaked Nexus 5 Specification & Review.

Nexus 5 620x473 Nexus 5 Specs Leaked
The leaked Nexus 5 is expected to have a huge 4.95-inch 1920×1080 display, a 8MP rear facing camera with optical image stabilization, 8.59mm thick, running Android 4.4 KitKat, using a 2.3Ghz quad-core processor, and coming in capacities of 16GB or 32GB.  The specs are very impressive compared to other smartphones out there so it’ll be interesting to see if Google list at cost price like they have with the Nexus 4 and Nexus 7.
Read more »