can anybody suggest me how to upload a file from my app's local storage directory to google drive using javascript in titanium Appcelerator.
i have tried the following code but it is not uploading the file.. thought some one can help me by seeing this code
code :
var ggParams = {
clientId: '662194379016.apps.googleusercontent',
clientSecret: 'ffRSIWBlXyPwW-M1iQ6DNtXZ',
redirectUri: 'http://localhost', //urn:ietf:wg:oauth:2.0:oob
devKey: 'AIzaSyBmXhfsc--2CdlSU8UD37Ryyd3qYaUxKls',
};
// Initialize Youtube Service
var google = new Google(ggParams);
google.login(function(e){
Ti.API.info('Token: ' + google.accessToken());
});
/* google.refreshToken(function(e){
Ti.API.info('New Token: ' + e.token);
});*/
/*var params = {
call: 'userinfo',
method: 'GET',
params: {
client_id: '662194379016.apps.googleusercontent',
client_secret: 'ffRSIWBlXyPwW-M1iQ6DNtXZ',
redirect_uri: 'http://localhost', //urn:ietf:wg:oauth:2.0:oob
devKey: 'AIzaSyBmXhfsc--2CdlSU8UD37Ryyd3qYaUxKls',
code:''
}
};*/
google.callMethod(
args = {
call: 'drive', //token
method: 'GET', //POST
params: {
clientId: '662194379016.apps.googleusercontent',
clientSecret: 'ffRSIWBlXyPwW-M1iQ6DNtXZ',
redirectUri: 'http://localhost', //urn:ietf:wg:oauth:2.0:oob
devKey: 'AIzaSyBmXhfsc--2CdlSU8UD37Ryyd3qYaUxKls',
code: 200
}
},
function(e){
if (e.success){
callback(e.data);
Ti.API.info(e.data);
}
else{
Ti.API.info(e.data);
Ti.API.error('Error getting tokens');
}
}, false); //true or false or null
can anybody suggest me how to upload a file from my app's local storage directory to google drive using javascript in titanium Appcelerator.
i have tried the following code but it is not uploading the file.. thought some one can help me by seeing this code
code :
var ggParams = {
clientId: '662194379016.apps.googleusercontent.',
clientSecret: 'ffRSIWBlXyPwW-M1iQ6DNtXZ',
redirectUri: 'http://localhost', //urn:ietf:wg:oauth:2.0:oob
devKey: 'AIzaSyBmXhfsc--2CdlSU8UD37Ryyd3qYaUxKls',
};
// Initialize Youtube Service
var google = new Google(ggParams);
google.login(function(e){
Ti.API.info('Token: ' + google.accessToken());
});
/* google.refreshToken(function(e){
Ti.API.info('New Token: ' + e.token);
});*/
/*var params = {
call: 'userinfo',
method: 'GET',
params: {
client_id: '662194379016.apps.googleusercontent.',
client_secret: 'ffRSIWBlXyPwW-M1iQ6DNtXZ',
redirect_uri: 'http://localhost', //urn:ietf:wg:oauth:2.0:oob
devKey: 'AIzaSyBmXhfsc--2CdlSU8UD37Ryyd3qYaUxKls',
code:''
}
};*/
google.callMethod(
args = {
call: 'drive', //token
method: 'GET', //POST
params: {
clientId: '662194379016.apps.googleusercontent.',
clientSecret: 'ffRSIWBlXyPwW-M1iQ6DNtXZ',
redirectUri: 'http://localhost', //urn:ietf:wg:oauth:2.0:oob
devKey: 'AIzaSyBmXhfsc--2CdlSU8UD37Ryyd3qYaUxKls',
code: 200
}
},
function(e){
if (e.success){
callback(e.data);
Ti.API.info(e.data);
}
else{
Ti.API.info(e.data);
Ti.API.error('Error getting tokens');
}
}, false); //true or false or null
Share
Improve this question
edited Sep 5, 2013 at 9:03
user2732609
asked Sep 5, 2013 at 4:47
user2732609user2732609
531 gold badge2 silver badges6 bronze badges
2
- stackoverflow./questions/12164024/… – Amit Prajapati Commented Sep 5, 2013 at 5:19
- Thank you for ur code.. but i m developing in javascript – user2732609 Commented Sep 5, 2013 at 5:33
1 Answer
Reset to default 1You need to check for Google API Java Client Upload to Google Docs
This is a sample Android application which uses the google-api-java-client library to demonstrate uploading a file to Google Docs.
This app will
- Perform OAuth2 authorization against Google Docs
- Create a folder (known as a collection) in Google Docs
- Upload a file to Google Docs (inside that folder)
- Update a file on Google Docs
Take a QuickStart to Google Drive API
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745396955a4625923.html
评论列表(0条)