<fragment android:id="@+id/place_autocomplete_fragment" android:layout_width="match_parent" android:layout_height="wrap_content" android:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment" />
// PlaceAutocompleteFragment fragment = (PlaceAutocompleteFragment) getFragmentManager().findFragmentById(R.id.place_autocomplete_fragment); fragment.setOnPlaceSelectedListener(new PlaceSelectionListener() { @Override public void onPlaceSelected(Place place) { // 選択したプレイスを処理 } @Override public void onError(Status status) { // エラーを処理 }
try { Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_FULLSCREEN) .build(this); startActivityForResult(intent, PLACE_AUTOCOMPLETE_REQUEST_CODE); } catch (GooglePlayServicesRepairableException e) { GooglePlayServicesUtil .getErrorDialog(e.getConnectionStatusCode(), getActivity(), 0); } catch (GooglePlayServicesNotAvailableException e) { // 例外を処理 }
@interface MyViewController () @end @implementation ViewController . . . - (IBAction)onLaunchClicked:(id)sender { // ボタン押下時にオートコンプリート ビュー コントローラーを表示 GMSAutocompleteViewController *acController = [[GMSAutocompleteViewController alloc] init]; acController.delegate = self; [self presentViewController:acController animated:YES completion:nil]; } - (void)viewController:(GMSAutocompleteViewController *)viewController didAutocompleteWithPlace:(GMSPlace *)place { // ユーザーがプレイスを選択 [self dismissViewControllerAnimated:YES completion:nil]; } - (void)viewController:(GMSAutocompleteViewController *)viewController didAutocompleteWithError:(NSError *)error { [self dismissViewControllerAnimated:YES completion:nil]; } // ユーザーがキャンセル ボタンを押下 - (void)wasCancelled:(GMSAutocompleteViewController *)viewController { [self dismissViewControllerAnimated:YES completion:nil]; } @end
import UIKit import GoogleMaps class MyViewController: UIViewController { @IBAction func onLaunchClicked(sender: AnyObject) { let acController = GMSAutocompleteViewController() acController.delegate = self self.presentViewController(acController, animated: true, completion: nil) } } extension MyViewController: GMSAutocompleteViewControllerDelegate { func viewController(viewController: GMSAutocompleteViewController!, didAutocompleteWithPlace place: GMSPlace!) { // ユーザーがプレイスを選択 self.dismissViewControllerAnimated(true, completion: nil) } func viewController(viewController: GMSAutocompleteViewController!, didAutocompleteWithError error: NSError!) { self.dismissViewControllerAnimated(true, completion: nil) } func wasCancelled(viewController: GMSAutocompleteViewController!) { self.dismissViewControllerAnimated(true, completion: nil) } }
public static Location createLocation(String accountName) throws Exception { Location location = new Location(); // Street address Address address = new Address(); List addressLines = Arrays.asList("740 Valencia Street"); address.setAddressLines(addressLines); address.setLocality("San Francisco"); address.setAdministrativeArea("CA"); address.setCountry("US"); address.setPostalCode("94110"); location.setAddress(address); // Business hours BusinessHours businessHours = new BusinessHours(); List periods = new ArrayList<>(); List days = Arrays.asList("Monday", "Tuesday", "Wednesday", "Thursday", "Friday"); for (String day : days) { TimePeriod period = new TimePeriod(); period.setOpenDay(day); period.setOpenTime("11:00"); period.setCloseTime("20:00"); period.setCloseDay(day); periods.add(period); } businessHours.setPeriods(periods); location.setBusinessHours(businessHours); // Special hours Date christmasEve = new Date().setYear(2015).setMonth(12).setDay(24); Date christmasDay = new Date().setYear(2015).setMonth(12).setDay(25); List periods = new ArrayList<>(); periods.add(new SpecialHourPeriod() .setStartDate(christmasEve) .setOpenTime("11:00") .setCloseTime("20:00") .setEndDate(christmasEve)); periods.add(new SpecialHourPeriod() .setStartDate(christmasDay) .setIsClosed(true)); SpecialHours specialHours = new SpecialHours() .setSpecialHourPeriods(periods); location.setSpecialHours(specialHours); location.setLocationName("Dandelion Chocolate"); location.setStoreCode("DC1"); location.setPrimaryPhone("415 349-0942"); location.setPrimaryCategory(new Category().setCategoryId("gcid:chocolate_shop")); location.setWebsiteUrl("https://www.dandelionchocolate.com/"); // Create Location CreateLocationRequest createLocationRequest = new CreateLocationRequest(); // RequestId is a unique id for each location created createLocationRequest.setRequestId(“1a84939c-ab7d-4581-8930-ee35af6fefac”); createLocationRequest.setLocation(location); createLocationRequest.setLanguageCode("en-US"); Mybusiness.Accounts.Locations.Create createLocation = mybusiness.accounts().locations().create(accountName, createLocationRequest); Location createdLocation = createLocation.execute(); System.out.printf("Created Location:\n%s", createdLocation.toPrettyString()); return createdLocation; }
getHintPicker
FusedLocationProviderApi
flushLocations
removeLocationUpdates
AppInvite.AppInviteApi.getInvitation()
import UIKit import GoogleMaps class MapRenderingViewController: UIViewController { @IBOutlet var mapView: GMSMapView! override func viewDidLoad() { super.viewDidLoad() mapView.delegate = self } // MARK: - GMSMapViewDelegate func mapViewDidStartTileRendering(mapView: GMSMapView!) { SVProgressHUD.showWithStatus("Loading tiles") } func mapViewDidFinishTileRendering(mapView: GMSMapView!) { SVProgressHUD.dismiss() } }
const GLuint ATTRIBUTE_LOCATION_POSITIONS = 0; const GLuint ATTRIBUTE_LOCATION_TEXTUREUV = 1; const GLuint ATTRIBUTE_LOCATION_NORMALS = 2; // Bind shader program, uniforms and textures // ... // Bind the vertex buffer glBindBuffer( GL_ARRAY_BUFFER, vertex_buffer_object ); // Set the vertex attributes glEnableVertexAttribArray( ATTRIBUTE_LOCATION_POSITIONS ); glVertexAttribPointer( ATTRIBUTE_LOCATION_POSITIONS, 3, GL_FLOAT, GL_FALSE, 32, 0 ); glEnableVertexAttribArray( ATTRIBUTE_LOCATION_TEXTUREUV ); glVertexAttribPointer( ATTRIBUTE_LOCATION_TEXTUREUV, 2, GL_FLOAT, GL_FALSE, 32, 12 ); glEnableVertexAttribArray( ATTRIBUTE_LOCATION_NORMALS ); glVertexAttribPointer( ATTRIBUTE_LOCATION_NORMALS, 3, GL_FLOAT, GL_FALSE, 32, 20 ); // Draw elements glDrawElements( GL_TRIANGLES, count, GL_UNSIGNED_SHORT, 0 );
const GLuint ATTRIBUTE_LOCATION_POSITIONS = 0; const GLuint ATTRIBUTE_LOCATION_TEXTUREUV = 1; const GLuint ATTRIBUTE_LOCATION_NORMALS = 2; // Bind the vertex buffer object glBindBuffer( GL_ARRAY_BUFFER, vertex_buffer_object ); // Create a VAO GLuint vao; glGenVertexArrays( 1, &vao ); glBindVertexArray( vao ); // Set the vertex attributes as usual glEnableVertexAttribArray( ATTRIBUTE_LOCATION_POSITIONS ); glVertexAttribPointer( ATTRIBUTE_LOCATION_POSITIONS, 3, GL_FLOAT, GL_FALSE, 32, 0 ); glEnableVertexAttribArray( ATTRIBUTE_LOCATION_TEXTUREUV ); glVertexAttribPointer( ATTRIBUTE_LOCATION_TEXTUREUV, 2, GL_FLOAT, GL_FALSE, 32, 12 ); glEnableVertexAttribArray( ATTRIBUTE_LOCATION_NORMALS ); glVertexAttribPointer( ATTRIBUTE_LOCATION_NORMALS, 3, GL_FLOAT, GL_FALSE, 32, 20 ); // Unbind the VAO to avoid accidentally overwriting the state // Skip this if you are confident your code will not do so glBindVertexArray( 0 );
// Create a vertex array object GLuint vao; glGenVertexArrays( 1, &vao ); glBindVertexArray( vao );
// Bind shader program, uniforms and textures // ... // Bind Vertex Array Object glBindVertexArray( vao ); // Draw elements glDrawElements( GL_TRIANGLES, count, GL_UNSIGNED_SHORT, 0 );
KeyPairGenerator.getInstance(KeyProperties.KEY_ALGORITHM_EC, "AndroidKeyStore"); keyPairGenerator.initialize( new KeyGenParameterSpec.Builder(KEY_NAME, KeyProperties.PURPOSE_SIGN) .setDigests(KeyProperties.DIGEST_SHA256) .setAlgorithmParameterSpec(new ECGenParameterSpec("secp256r1")) .setUserAuthenticationRequired(true) .build()); keyPairGenerator.generateKeyPair();
.setUserAuthenticationRequired(true)
KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore"); keyStore.load(null); PublicKey publicKey = keyStore.getCertificate(MainActivity.KEY_NAME).getPublicKey(); KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore"); keyStore.load(null); PrivateKey key = (PrivateKey) keyStore.getKey(KEY_NAME, null);
boolean enroll(String userId, String password, PublicKey publicKey);
Signature.getInstance("SHA256withECDSA"); KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore"); keyStore.load(null); PrivateKey key = (PrivateKey) keyStore.getKey(KEY_NAME, null); signature.initSign(key); CryptoObject cryptObject = new FingerprintManager.CryptoObject(signature); CancellationSignal cancellationSignal = new CancellationSignal(); FingerprintManager fingerprintManager = context.getSystemService(FingerprintManager.class); fingerprintManager.authenticate(cryptoObject, cancellationSignal, 0, this, null);
Signature signature = cryptoObject.getSignature(); // Include a client nonce in the transaction so that the nonce is also signed // by the private key and the backend can verify that the same nonce can't be used // to prevent replay attacks. Transaction transaction = new Transaction("user", 1, new SecureRandom().nextLong()); try { signature.update(transaction.toByteArray()); byte[] sigBytes = signature.sign(); // Send the transaction and signedTransaction to the dummy backend if (mStoreBackend.verify(transaction, sigBytes)) { mActivity.onPurchased(sigBytes); dismiss(); } else { mActivity.onPurchaseFailed(); dismiss(); } } catch (SignatureException e) { throw new RuntimeException(e); }
@Override public boolean verify(Transaction transaction, byte[] transactionSignature) { try { if (mReceivedTransactions.contains(transaction)) { // It verifies the equality of the transaction including the client nonce // So attackers can't do replay attacks. return false; } mReceivedTransactions.add(transaction); PublicKey publicKey = mPublicKeys.get(transaction.getUserId()); Signature verificationFunction = Signature.getInstance("SHA256withECDSA"); verificationFunction.initVerify(publicKey); verificationFunction.update(transaction.toByteArray()); if (verificationFunction.verify(transactionSignature)) { // Transaction is verified with the public key associated with the user // Do some post purchase processing in the server return true; } } catch (NoSuchAlgorithmException | InvalidKeyException | SignatureException e) { // In a real world, better to send some error message to the user } return false; }