View gsi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (opr.isDone()) { | |
// If the user's cached credentials are valid, the OptionalPendingResult will be "done" | |
// and the GoogleSignInResult will be available instantly. We can try and retrieve an | |
// authentication code. | |
GoogleSignInResult result = opr.get(); | |
handleSignInResult(result); | |
} else { | |
// If the user has not previously signed in on this device or the sign-in has expired, | |
// this asynchronous branch will attempt to sign in the user silently. | |
opr.setResultCallback(new ResultCallback<GoogleSignInResult>() { |
View gsi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mGoogleApiClient = new GoogleApiClient.Builder(this /* Context */) | |
.enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */) | |
.addApi(Auth.GOOGLE_SIGN_IN_API, gso) | |
.build(); |
View gsi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OptionalPendingResult<GoogleSignInResult> opr = Auth.GoogleSignInApi.silentSignIn(mGoogleApiClient); |
View gsi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GoogleSignInAccount acct = googleSignInResult.getSignInAccount(); | |
String authCode = acct.getServerAuthCode(); |
View ViewController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ViewController: UIViewController, GIDSignInDelegate { | |
@IBOutlet weak var signInButton: GIDSignInButton! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
GIDSignIn.sharedInstance().delegate = self | |
// Test to see if we are signed in on load. | |
GIDSignIn.sharedInstance().signInSilently() | |
} |
View AppDelegate.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
func application(application: UIApplication, | |
didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { | |
GIDSignIn.sharedInstance().clientID = "366667191730-38onttdkl2cpqstheip1ek3r5tb8s5ds.apps.googleusercontent.com"; | |
return true | |
} |
View drive.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once "../vendor/autoload.php"; | |
$client = new Google_Client(); | |
$client->setApplicationName("Service Acccount Test"); | |
$client_id = '985145966381-is5nq94smihmoa2k0567jab6u6vj278c.apps.googleusercontent.com'; | |
$service_account_name = '985145966381-is5nq94smihmoa2k0567jab6u6vj278c@developer.gserviceaccount.com'; | |
$key_file_location = 'foostarter-a27f84b2dec4.p12'; |
View analytics.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once "../vendor/autoload.php"; | |
$client = new Google_Client(); | |
$client->setApplicationName("Service Acccount Test"); | |
$client_id = '985145966381-is5nq94smihmoa2k0567jab6u6vj278c.apps.googleusercontent.com'; | |
$service_account_name = '985145966381-is5nq94smihmoa2k0567jab6u6vj278c@developer.gserviceaccount.com'; | |
$key_file_location = 'foostarter-a27f84b2dec4.p12'; |
View gist:ea06ff3b15f4c24b2c72
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[deviceManager launchApplication:applicationID | |
withLaunchOptions:[[GCKLaunchOptions alloc] initWithLanguageCode:nil | |
relaunchIfRunning:YES]]; |
View gist:1d8cc6ed1857c3144162
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)deviceDidGoOffline:(GCKDevice *)device { | |
[self performSelector:@selector(updateCastIconButtonStates) withObject:nil afterDelay:0]; | |
} |
NewerOlder