<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jutamart Kotkaew on Medium]]></title>
        <description><![CDATA[Stories by Jutamart Kotkaew on Medium]]></description>
        <link>https://medium.com/@jutamart.kot?source=rss-faf1950f8bbe------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*_82G9bWPp95RhkT9h_fHDg@2x.jpeg</url>
            <title>Stories by Jutamart Kotkaew on Medium</title>
            <link>https://medium.com/@jutamart.kot?source=rss-faf1950f8bbe------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 12:42:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jutamart.kot/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Maps in Flutter: Google Maps API Integration]]></title>
            <link>https://medium.com/odds-team/maps-in-flutter-google-maps-api-integration-1f5cdd6a88f2?source=rss-faf1950f8bbe------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f5cdd6a88f2</guid>
            <category><![CDATA[google-map-api]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Jutamart Kotkaew]]></dc:creator>
            <pubDate>Mon, 06 Jan 2025 13:40:21 GMT</pubDate>
            <atom:updated>2025-02-17T02:06:52.496Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cJI-MtFZGN-qCaDb" /><figcaption>Photo by <a href="https://unsplash.com/@qikealarcon?utm_source=medium&amp;utm_medium=referral">Enrique Alarcon</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>ปัจจุบันแอปพลิเคชันจำนวนมากมีการนำฟีเจอร์แผนที่เข้ามาใช้งาน เพื่อเพิ่มความสะดวกสบายให้กับผู้ใช้ และหนึ่งในตัวเลือกยอดนิยมสำหรับการใช้งานฟีเจอร์แผนที่คือ <strong>Google Maps API</strong> ซึ่งเป็นเครื่องมือที่ได้รับความนิยมและใช้งานกันอย่างแพร่หลาย</blockquote><blockquote>บทความนี้จะพาคุณไปเรียนรู้วิธีการ <strong>Integrate Google Maps API</strong> เข้ากับแอปพลิเคชัน <strong>Flutter</strong> อย่างละเอียด ตั้งแต่การตั้งค่าโปรเจกต์ การสร้างและรักษาความปลอดภัยให้กับ API Key ไปจนถึงการใช้งานฟีเจอร์ของแผนที่ในแอปพลิเคชันของคุณ</blockquote><blockquote><strong>หัวข้อที่เราจะพูดถึงในบทความนี้</strong> ได้แก่:<br>1. Prerequisites <br>2. API Key และ OAuth Credentials <br>3. Installing Dependencies<br>4. Examples of Usage<br>5. Managing Multiple Environments<br>ไปลุยกันเลย! 🚀</blockquote><h3><strong>— Prerequisites —</strong></h3><ul><li>Flutter SDK, Android Studio/VS Code</li><li>Project Flutter</li><li>Project บน Google Cloud</li></ul><h3><strong>— API Key และ OAuth Credentials —</strong></h3><p><a href="https://console.cloud.google.com/">https://console.cloud.google.com/</a></p><ol><li>เลือก <strong>Project</strong> &gt; <strong>enabled API AND service &gt; </strong><br>enable <strong>Maps SDK for iOS</strong> หรือ<strong> Maps SDK for Android</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-BF3ZCLEeUrK810Nwsbfgw.png" /></figure><p>2. Credentials &gt; Create Credentials &gt; Edit API key</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*V92VMOZ_EUFW5EruS7Selg.png" /></figure><h4>API key restrictions</h4><p>ค่า Default key restrictions จะเป็น none เพื่อความปลอดภัยในการใช้ API key ควรที่จะ set application restriction และ API restrictions ที่ระบุเจาะจงว่าใช้สำหรับ websites, IP addresses, Android apps หรือ iOS apps และ API ที่ใช้มีอะไรบ้าง</p><ol><li><strong>set application restriction</strong></li></ol><ul><li><strong>HTTP referrers</strong> : สำหรับใช้งานบนเว็บ โดยระบุเว็บไซต์ที่สามารถใช้คีย์ได้ เช่น www.example.com/path,www.example.com/path/path ,www.example.com/*,sub.example.com/*,example.com/*,*.example.com/*</li><li><strong>IP Addresses : </strong>สำหรับเรียกใช้โดยเซิร์ฟเวอร์ หรือ corn job ที่สามารถใช้คีย์ได้ เช่น IPv4 (198.51.100.1) , IPv6 (2001:db8::1) , A subnet using CIDR notation (198.51.100.0/24, 2001:db8::/64)</li><li><strong>Android apps : </strong>สำหรับเรียก Android applications โดยจะต้องใช้ Package name และ certificate fingerprint ที่สามารถใช้คีย์ได้</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*RSvzlMXuIm3K90kdixRAVQ.png" /><figcaption><strong>Android apps</strong></figcaption></figure><p><strong><em>How to get certificate fingerprint</em></strong></p><p><strong>For Debug :</strong></p><p>For Linux or macOS:</p><pre>keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android</pre><p>For Windows:</p><pre>keytool -list -v -keystore &quot;%USERPROFILE%\.android\debug.keystore&quot; -alias androiddebugkey -storepass android -keypass android</pre><p><strong>For Release</strong> :</p><pre>keytool -list -v -keystore your_keystore_name -alias your_alias_name</pre><p>หรือสามารถหาได้จาก <strong>Google Play Console</strong> : Release &gt; Setup &gt; App IntegrityRelease &gt; Setup &gt; App Integrity</p><ul><li><strong>iOS apps : </strong>สำหรับ iOS applications โดยระบุ bundles id ที่สามารถใช้คีย์ได้</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*UNUbKiNe0O11loXR0_v_NQ.png" /></figure><p><strong>2. set API restrictions :</strong></p><p><strong>API restrictions</strong> ควรเลือกเฉพาะ API ที่ใช้ เพื่อป้องกันการถูกเรียกใช้ API นอกเหนือที่จำเป็น เช่น สำหรับเรียก Android applications สามารถเลือกแค่ Maps SDK for Android ได้เลย</p><h3><strong>— Installing Dependencies —</strong></h3><p>Run command:</p><pre>flutter pub add google_maps_flutter</pre><p>หรือสามารถเพิ่ม package’s ที่ pubspec.yaml แล้ว `flutter pub get`</p><pre>dependencies:<br>  google_maps_flutter: ^2.10.0</pre><h3><strong>— Project Configuration —</strong></h3><p>สามารถ copy key ที่สร้างเมื่อกี้มาได้เลย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*9Rlt4LEvjkF82a5Q__RGfw.png" /><figcaption>API key</figcaption></figure><h4>Android</h4><p>เพิ่ม API key ที่ android/app/src/main/AndroidManifest.xml:</p><pre>&lt;manifest ...<br>  &lt;application ...<br>    &lt;meta-data android:name=&quot;com.google.android.geo.API_KEY&quot;<br>               android:value=&quot;YOUR KEY HERE&quot;/&gt;</pre><ul><li>การตั้งค่าไฟล์ android/app/src/main/AndroidManifest.xml สำหรับ API Key</li></ul><h4>iOS</h4><p>เพิ่ม API key ที่ ios/Runner/Info.plist</p><pre>import UIKit<br>import Flutter<br>import GoogleMaps<br><br>@UIApplicationMain<br>@objc class AppDelegate: FlutterAppDelegate {<br>  override func application(<br>    _ application: UIApplication,<br>    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?<br>  ) -&gt; Bool {<br>    GMSServices.provideAPIKey(&quot;YOUR KEY HERE&quot;)<br>    GeneratedPluginRegistrant.register(with: self)<br>    return super.application(application, didFinishLaunchingWithOptions: launchOptions)<br>  }<br>}</pre><h3><strong>— Examples of Usage — </strong>⏱️</h3><pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:google_maps_flutter/google_maps_flutter.dart&#39;;<br><br>class MapSampleState extends StatelessWidget {<br>  const MapSampleState({super.key});<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return const Scaffold(<br>      body: GoogleMap(<br>          initialCameraPosition: CameraPosition(<br>        target: LatLng(37.42796133580664, -122.085749655962),<br>        zoom: 14.4746,<br>      )),<br>    );<br>  }<br>}</pre><ul><li>Marker 📍</li></ul><pre>  <br>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:google_maps_flutter/google_maps_flutter.dart&#39;;<br><br>class MapMaker extends StatelessWidget {<br>  const MapMaker({super.key});<br><br>  @override<br>  Widget build(BuildContext context) {<br>    const lat = 37.42796133580664;<br>    const lng = -122.085749655962;<br>    Marker marker = const Marker(<br>      markerId: MarkerId(&quot;location&quot;),<br>      position: LatLng(<br>        lat,<br>        lng,<br>      ),<br>    );<br>    return Scaffold(<br>      body: GoogleMap(<br>        initialCameraPosition: const CameraPosition(<br>          target: LatLng(lat, lng),<br>          zoom: 14.4746,<br>        ),<br>        markers: &lt;Marker&gt;{marker},<br>      ),<br>    );<br>  }<br>}</pre><h3>—Managing Multiple Environments—</h3><p>สำหรับในแต่ละ Enviroment ที่มี API key ต่างกัน</p><p><strong>iOS</strong></p><p>set <strong>Active Compilation Conditions แต่ละ flavor </strong>ที่ XCode หลังจากที่ set เรียบร้อย จะเกิด change ที่ ios/Runner.xcodeproj/project.pbxproj</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3fZdDSgJUZ8rEx2I9nKtaQ.png" /></figure><p>ios/Runner/AppDelegate.swift</p><pre>import UIKit<br>import Flutter<br>import GoogleMaps<br><br>@UIApplicationMain<br>@objc class AppDelegate: FlutterAppDelegate {<br>  override func application(<br>    _ application: UIApplication,<br>    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?<br>  ) -&gt; Bool {<br><br>    // Using active compilation conditions to provide the right API key for the right flavor.<br>    #if DEV<br>        GMSServices.provideAPIKey(&quot;YOUR DEV KEY HERE&quot;)<br>    #elseif UAT<br>        GMSServices.provideAPIKey(&quot;YOUR UAT KEY HERE&quot;)<br>    #elseif PROD<br>        GMSServices.provideAPIKey(&quot;YOUR PROD KEY HERE&quot;)<br>    #endif<br><br>    GeneratedPluginRegistrant.register(with: self)<br>    return super.application(application, didFinishLaunchingWithOptions: launchOptions)<br>  }<br>}</pre><p><strong>Android</strong></p><ol><li>android/app/src/main/AndroidManifest.xml</li></ol><pre>&lt;meta-data android:name=&quot;com.google.android.geo.API_KEY&quot;<br>            android:value=&quot;@string/google_maps_api_key&quot;/&gt;</pre><p>2. android/app/build.gradle</p><pre>productFlavors {<br>        dev {<br>            resValue &quot;string&quot;, &quot;google_maps_api_key&quot;, &quot;YOUR KEY HERE&quot;<br>        }<br>        uat {<br>            resValue &quot;string&quot;, &quot;google_maps_api_key&quot;, &quot;YOUR KEY HERE&quot;<br>        }<br>        prod {<br>            resValue &quot;string&quot;, &quot;google_maps_api_key&quot;, &quot;YOUR KEY HERE&quot;<br>        }</pre><p><strong>Reference</strong></p><p><a href="https://pub.dev/packages/google_maps_flutter">https://pub.dev/packages/google_maps_flutter</a></p><p><a href="https://console.cloud.google.com/">https://console.cloud.google.com</a></p><p><a href="https://stackoverflow.com/questions/62419765/different-google-maps-api-key-for-each-flavor-build-on-flutter-ios">https://stackoverflow.com/questions/62419765/different-google-maps-api-key-for-each-flavor-build-on-flutter-ios</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f5cdd6a88f2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/odds-team/maps-in-flutter-google-maps-api-integration-1f5cdd6a88f2">Maps in Flutter: Google Maps API Integration</a> was originally published in <a href="https://medium.com/odds-team">odds.team</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting started S3 with Kotlin Spring Boot]]></title>
            <link>https://medium.com/odds-team/getting-started-s3-with-kotlin-spring-boot-64e0c4a88865?source=rss-faf1950f8bbe------2</link>
            <guid isPermaLink="false">https://medium.com/p/64e0c4a88865</guid>
            <category><![CDATA[spring-boot-kotlin]]></category>
            <category><![CDATA[s3]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Jutamart Kotkaew]]></dc:creator>
            <pubDate>Tue, 06 Feb 2024 23:57:26 GMT</pubDate>
            <atom:updated>2024-02-06T23:57:26.389Z</atom:updated>
            <content:encoded><![CDATA[<p>หากอยากรู้ว่า S3 คือ อะไร : <a href="https://www.blognone.com/node/101588">https://www.blognone.com/node/101588</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*2zkcWCfm1sH3Y8wI.png" /><figcaption>AWS S3 image generated by ChatGPT-4</figcaption></figure><h3>Pre-requisite<strong> :</strong></h3><ol><li>account aws ที่มี permission in s3</li><li>AWS credentials : ที่จะประกอบด้วย ACCESS_KEY_ID , SECRET_ACCESS_KEY</li><li>project Kotlin springboot with Spring Web Dependency <a href="https://start.spring.io/">https://start.spring.io/</a></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*06tT-Gkkw7lfeHACoquV6A.png" /></figure><p>โดย IDE ที่ใช้จะเป็น IntelliJ</p><p><strong><em>การสร้าง Bucket</em></strong></p><p>การสร้าง bucket เพื่อเก็บข้อมูล โดยการตั้งชื่อจะต้องไม่ซ้ำกับชื่อ bucket ทั้งระบบของ S3 ซึ่งชื่อที่ตั้งไว้จะกลายเป็นส่วนหนึ่งของ URL สำหรับให้เข้าถึง</p><p>** โดยในตัวอย่างเป็นการตั้งค่าเป็นตามที่ S3 แนะนำ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_6sjZxTNKvujoMy2mYnvhA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*gSR_7YJnCIUcyVBQplnoEA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*f-mD05nCQ5Ed3gu2EzZwEg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*nb2JU6kp6KLmlYeu1UTDyQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*G5MixRFusTneiAFsEfWWEQ.png" /></figure><p>หลังจากที่ ได้ bucket มาเรียบร้อยแล้ว ก็ทำการ สร้าง folder และสามารถ upload file ได้เลย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2eSNfHMH02g5CBMxKbLKPg.png" /></figure><p>มาต่อกันในส่วนของ API เพื่อเรียกใช้ S3 กัน</p><p><strong><em>Dependencies : </em></strong>Gradle Build Tool</p><pre>dependencies {<br> implementation(&quot;org.springframework.boot:spring-boot-starter-web&quot;)<br> implementation(&quot;com.fasterxml.jackson.module:jackson-module-kotlin&quot;)<br> implementation(&quot;org.jetbrains.kotlin:kotlin-reflect&quot;)<br> implementation(&quot;aws.sdk.kotlin:s3:1.0.40&quot;)<br> testImplementation(&quot;org.springframework.boot:spring-boot-starter-test&quot;)<br>}</pre><p><strong><em>Set env by edit configuration</em></strong></p><p>ไปที่แถบด้านบน</p><p>Run &gt; Edit configuration &gt; Kotlin &gt; file.kt</p><p>หากไม่มีทำการเพิ่ม กดปุ่ม + &gt; Add New configuration &gt; Kotlin</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*whbx1JzWrNrOoEfZnrY90Q.png" /></figure><p>เลือก Main class: เป็น file Application.kt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BmeHp0dS7cgJQo19MQzazw.png" /></figure><p>set environment variable : กรอก AWS credentials จากนั้น Apply</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*mHcmbsBUmTlPkdpks9qe3A.png" /></figure><p><strong><em>สร้าง Controller</em></strong></p><pre>@RestController<br>@RequestMapping(&quot;/download&quot;)<br>public class FileController(<br>        val downloadService:DownloadService<br>) {<br>    @GetMapping(&quot;/file&quot;)<br>    fun getFile(@RequestParam(&quot;keyName&quot;)keyName :String)<br>                : RedirectView {<br>        return RedirectView(downloadService<br>                            .download(&quot;ชื่อของ bucket ที่สร้าง&quot;,keyName))<br>    }<br>}</pre><p><strong><em>สร้าง Service</em></strong></p><pre>class DownloadService {<br>    fun download(bucketName: String,<br>                 keyName: String): String = runBlocking {<br><br>        val s3 = S3Client.fromEnvironment() { region = &quot;ap-southeast-1&quot; }<br>        val bucketName = bucketName<br>        val keyName = keyName<br>        val presignedUrl = getObjectPresigned(s3, bucketName, keyName)<br><br>        return@runBlocking presignedUrl<br>    }<br><br>    suspend fun getObjectPresigned(s3: S3Client, <br>                                   bucketName: String, <br>                                   keyName: String): String {<br><br>        // Create a GetObjectRequest.<br>        val unsignedRequest = GetObjectRequest {<br>            bucket = bucketName<br>            key = keyName<br>        }<br>        // Presign the GetObject request.<br>        val presignedRequest = s3.presignGetObject(unsignedRequest, 24.hours)<br>        return presignedRequest.url.toString()<br>    }<br>}</pre><p>โดย API จะถูกเรียกด้วย path: http://localhost:8080/download/file ที่ส่ง Request Param เป็น keyName ซึ่ง keyName ที่ส่งไปนี้จะเป็น path ของ object ใน S3 (สามารถกดเข้าไปในไฟล์เพื่อ copy key มาได้เลย)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EUwV7u68kCAdDnHV1Om8Vw.png" /></figure><p><strong><em>Postman call API</em></strong></p><p>จากนั้นก็ทำการลองยิง Postman ตาม Path ที่ตั้งไว้ และใส่ Key และ Value ของ keyName ที่สร้างเป็น RequestParam ไว้ใน controller (path ของ object ใน S3) หรือสามารถนำ Path ไปวางที่ web browser ได้เช่นกัน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NcA6S6Y0H1y8NVq9XRHSmQ.png" /></figure><p><strong><em>แก้ไข meta data เพื่อเปลี่ยน content type</em></strong></p><p>เนื่องจากไฟล์ที่ได้ออกมายังเป็น file สำหรับ preview อยู่ สามารถแก้ไขให้สามารถ Download file ได้เลย โดยการเปลี่ยน type Metadata ใน Bucket ให้มี Value = application/octet-stream</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H21BY8rp78BATiZ7-dyDzQ.png" /></figure><p>เท่านี้เราก็สามารถDownload file จาก S3 ได้แล้วค่ะ</p><p><strong>Sources :</strong></p><p>Doc SDK for Kotlin : <a href="https://docs.aws.amazon.com/sdk-for-kotlin/latest/developer-guide/home.html">https://docs.aws.amazon.com/sdk-for-kotlin/latest/developer-guide/home.html</a></p><p>Set up Enviroment in Kotlin : <a href="https://www.twilio.com/en-us/blog/set-up-env-variables-intellij-idea-java">https://www.twilio.com/en-us/blog/set-up-env-variables-intellij-idea-java</a></p><p>Git Ropo : <a href="https://github.com/awsdocs/aws-doc-sdk-examples">aws-doc-sdk-examples</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64e0c4a88865" width="1" height="1" alt=""><hr><p><a href="https://medium.com/odds-team/getting-started-s3-with-kotlin-spring-boot-64e0c4a88865">Getting started S3 with Kotlin Spring Boot</a> was originally published in <a href="https://medium.com/odds-team">odds.team</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>