![]() ![]() Click on Manage Accounts in the top-right corner.Click on the Settings (gear) button in the bottom-left corner.To change the calendar account name, use these steps: For example, you can use something like "Work" or "Personal," or you can use the email address. If you want to better identify the accounts, you can change the name to something more descriptive. When setting up a new account, the Calendar app uses the name of service as the name for the account. If you have another personal or work account, just repeat the same steps outlined above. You can add as many accounts as you need. Once you complete these steps, the events from the service you configured should start syncing on the device. Continue with the on-screen directions to finish adding the account using the account credentials.(Optional) Click the Advanced setup option to add other internet mail services using POP or IMAP.Public static void main(String.Source: Windows Central (Image credit: Source: Windows Central) returns an authorized Credential object. LocalServerReceiver receiver = new LocalServerReceiver.Builder().setPort(8888).build() Ĭredential credential = new AuthorizationCodeInstalledApp(flow, receiver).authorize("user") setDataStoreFactory(new FileDataStoreFactory(new java.io.File(TOKENS_DIRECTORY_PATH))) HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES) GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder( Build flow and trigger user authorization request. GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in)) Throw new FileNotFoundException("Resource not found: " + CREDENTIALS_FILE_PATH) InputStream in = (CREDENTIALS_FILE_PATH) Private static Credential getCredentials(final NetHttpTransport HTTP_TRANSPORT) * IOException If the credentials.json file cannot be found. * HTTP_TRANSPORT The network HTTP Transport. * Creates an authorized Credential object. Private static final String CREDENTIALS_FILE_PATH = "/credentials.json" * If modifying these scopes, delete your previously saved tokens/ folder.Ĭollections.singletonList(CalendarScopes.CALENDAR_READONLY) * Global instance of the scopes required by this quickstart. Private static final String TOKENS_DIRECTORY_PATH = "tokens" * Directory to store authorization tokens for this application. Private static final JsonFactory JSON_FACTORY = GsonFactory.getDefaultInstance() Private static final String APPLICATION_NAME = "Google Calendar API Java Quickstart" * class to demonstarte use of Calendar events list API */ Open the default adle file and replace its contents with the In the src/main/resources/ directory, copy the credentials.json file Mkdir -p src/main/java src/main/resources In your working directory, create a new project structure: gradle init -type basic Make a note of these credentials because you need them later in this quickstart. The newly created credential appears under OAuth 2.0 Client IDs. The OAuth client created screen appears, showing your new Client ID and Client secret. This name is only shown in the Google Cloud console. In the Name field, type a name for the credential.Click Create Credentials > OAuth client ID.In the Google Cloud console, go to the Credentials page. You must create a separate client ID for each platform. To authenticate as an end user and access user data in your app, you need toĬreate one or more OAuth 2.0 Client IDs. In the Google Cloud console, enable the Google Calendar API.Īuthorize credentials for a desktop application You can enable one or more APIs in a single Google Cloud project. Enable the APIīefore using Google APIs, you need to enable them in a Google Cloud project. To complete this quickstart, set up your environment. A Google account with Google Calendar enabled.If you're unfamiliar with authentication and authorization forĪuthentication and authorization overview.Ĭreate a Java command-line application that makes requests to the Google Calendar API. Before you can run the sampleĪpp, each quickstart requires that you turn on authentication andĪuthorization. You use the client libraries for your own apps. Google Workspace quickstarts use the API client libraries to handle someĭetails of the authentication and authorization flow. Quickstarts explain how to set up and run an app that calls a ![]()
0 Comments
Leave a Reply. |