Skip to content

Commit 25c5981

Browse files
committed
Update Drive Activity sample code with bug fixes and updates.
The v2 API sample was updated to use the new "drive" elements, and versions were updated to point to the latest client libraries. Bugs were also fixed for both the v1 and v2 APIs.
1 parent f44a546 commit 25c5981

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

drive/activity-v2/quickstart/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repositories {
1111
}
1212

1313
dependencies {
14-
compile 'com.google.api-client:google-api-client:1.27.0'
15-
compile 'com.google.oauth-client:google-oauth-client-jetty:1.27.0'
16-
compile 'com.google.apis:google-api-services-driveactivity:v2-rev20181113-1.27.0'
14+
compile 'com.google.api-client:google-api-client:1.25.0'
15+
compile 'com.google.oauth-client:google-oauth-client-jetty:1.25.0'
16+
compile 'com.google.apis:google-api-services-driveactivity:v2-rev76-1.25.0'
1717
}

drive/activity-v2/quickstart/src/main/java/DriveActivityQuickstart.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ public class DriveActivityQuickstart {
5454
/**
5555
* Global instance of the scopes required by this quickstart.
5656
*
57-
* <p>If modifying these scopes, delete your previously saved credentials at
58-
* ~/.credentials/driveactivity-java-quickstart
57+
* <p>If modifying these scopes, delete your previously saved tokens/ folder.
5958
*/
6059
private static final List<String> SCOPES =
6160
Arrays.asList(DriveActivityScopes.DRIVE_ACTIVITY_READONLY);
61+
private static final String CREDENTIALS_FILE_PATH = "/credentials.json";
6262

6363
static {
6464
try {
@@ -78,7 +78,7 @@ public class DriveActivityQuickstart {
7878
*/
7979
public static Credential authorize() throws IOException {
8080
// Load client secrets.
81-
InputStream in = DriveActivityQuickstart.class.getResourceAsStream("/credentials.json");
81+
InputStream in = DriveActivityQuickstart.class.getResourceAsStream(CREDENTIALS_FILE_PATH);
8282
if (in == null) {
8383
throw new FileNotFoundException("Resource not found: " + CREDENTIALS_FILE_PATH);
8484
}
@@ -200,8 +200,8 @@ private static String getTargetInfo(Target target) {
200200
if (target.getDriveItem() != null) {
201201
return "driveItem:\"" + target.getDriveItem().getTitle() + "\"";
202202
}
203-
if (target.getTeamDrive() != null) {
204-
return "teamDrive:\"" + target.getTeamDrive().getTitle() + "\"";
203+
if (target.getDrive() != null) {
204+
return "drive:\"" + target.getDrive().getTitle() + "\"";
205205
}
206206
if (target.getFileComment() != null) {
207207
DriveItem parent = target.getFileComment().getParent();

drive/activity/quickstart/src/main/java/DriveActivityQuickstart.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ public class DriveActivityQuickstart {
5656

5757
/** Global instance of the scopes required by this quickstart.
5858
*
59-
* If modifying these scopes, delete your previously saved credentials
60-
* at ~/.credentials/appsactivity-java-quickstart
59+
* <p>If modifying these scopes, delete your previously saved tokens/ folder.
6160
*/
6261
private static final List<String> SCOPES = Arrays.asList(AppsactivityScopes.ACTIVITY);
62+
private static final String CREDENTIALS_FILE_PATH = "/credentials.json";
6363

6464
static {
6565
try {
@@ -79,7 +79,7 @@ public class DriveActivityQuickstart {
7979
public static Credential authorize() throws IOException {
8080
// Load client secrets.
8181
InputStream in =
82-
DriveActivityQuickstart.class.getResourceAsStream("/credentials.json");
82+
DriveActivityQuickstart.class.getResourceAsStream(CREDENTIALS_FILE_PATH);
8383
if (in == null) {
8484
throw new FileNotFoundException("Resource not found: " + CREDENTIALS_FILE_PATH);
8585
}

0 commit comments

Comments
 (0)