Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,025

HOME > Windows Azure > Windows Azure (Mobile Services) and Android > ตอนที่ 3 : การสร้าง Android Mobile Services และการเรียกใช้งานแบบง่าย ๆ



Clound SSD Virtual Server

ตอนที่ 3 : การสร้าง Android Mobile Services และการเรียกใช้งานแบบง่าย ๆ

ตอนที่ 3 : การสร้าง Android Mobile Services และการเรียกใช้งานแบบง่าย ๆ บทความนี้เราจะมาเริ่มต้นการสร้าง Android Mobile Services ทีอยู่บน Windows Azure และทำความเข้าใจกับส่วนประกอบต่าง ๆ ในหน้าจอ Portal Management รวมทั้งการดาวน์โหลด Project ตัวอย่างที่จะสามารถ Download แล้วนำไปทดสอบบน Eclipse ได้ในทันที

ใน Project Sample ที่เป็นตัวอย่างของ Android จะเป็นการสร้าง Table ที่ชื่อว่า TodoItem จากนั้นจะมีการส่งข้อมูลจาก Android แล้วนำข้อมูลที่ได้ไปจัดเก็บไว้ใน Table ของ Mobile Services ที่อยู่บน Windows Azure

ตอนที่ 2 : เตรียมความพร้อมของ Android ก่อนที่จะเขียน Android กับ Mobile Services


Android Create Mobile Services

ในหน้าจอบน Portal Management ของ Windows Azure ให้เลือก Service ของ Mobile Services เราสามารถคลิกที่ Create a new Mobile Service ได้ในทันที

Android Create Mobile Services

หรือจะคลิกที่ New

Android Create Mobile Services

เลือก COMPUTE -> MOBILE SERVICE -> CREATE

Android Create Mobile Services

บริการ Mobile Services จะต้องมีการกำหนด URL ซึ่งจะอยู่ภายใต้ Subdomain ของ azure-mobile.net และเลือก Create a new SQL database instance

Android Create Mobile Services

กำหนดชื่อ Database รวมทั้งเลือก New SQL database server พร้อมกับกำหนด Username และ Password ในการ Login








Android Create Mobile Services

จากนั้นเราจะได้ Mobile Services ขึ้นมา 1 รายการ ให้คลิกเข้าไปในหน้าหลัก

Android Create Mobile Services

ในหน้าหลักให้เราเลือก Platform เป็นของ Android และเลือก CREATE A NEW ANDROID APP

Android Create Mobile Services

ขั้นตอนนี้จะมีอยู่ 3 Step คือ
  • 1. ติดตั้ง Android SDK ซึ่งเราได้ติดตั้งจากบทความก่อนหน้านี้แล้ว
  • 2. ให้คลิกที่ Create TodoItem Table เพื่อทำการสร้างตารางสำหรับเก็บข้อมูลที่มีชื่อว่า TodoItem
  • 3. ให้ดาวน์โหลด Sample Project เพื่อนำไปรันทดสอบบนโปรแกรม Eclispe ได้ในทันที


Android Create Mobile Services\

จะได้ไฟล์ zip ซึ่งจะเป็นชื่อของ Mobile Services ที่เราสร้างขึ้น

Android Create Mobile Services

หลังจากที่ดาวน์โหลดแล้วให้ทำการแตกไฟล์ zip แล้วจัดเก็บไฟล์ทั้งหมดไว้ในโฟเดอร์ที่เข้าถึงง่าย ๆ

Android Create Mobile Services

เปิดโปรแกรม Eclipse

Android Create Mobile Services

เลือกเมนู File -> Import

Android Create Mobile Services

เลือก Android -> Existing Android Code Into Workspace

Android Create Mobile Services

ให้ Browse เลือกโฟเดอร์ของ Project ที่เราได้ดาวน์โหลดใว้ จากนั้นก็เลือก Project แล้วเลือก Finish ตามลำดับ

Android Create Mobile Services

ถ้าขึ้น Error แบบนี้แสดงว่าเรายังไม่มี Android SDK 4.2+ (API17) ให้ติดตั้งและดาวน์โหลดได้จากบทความก่อนหน้านี้

Android Create Mobile Services

หลังจากที่ Import Project สมบูรณ์ รายการไฟล์ก็จะแสดงดังรูป โดยสังเกตุว่า Android จะต้องเป็น Version 4.2.2 หรือสูงนี้

Android Create Mobile Services

โครงสร้างไฟล์ต่าง ๆ ที่ Project ตัวอย่างมีมาให้

Android Create Mobile Services

ทดสอบการรันบน Emulator โดยคลิกที่ Run -> Run Configurations

Android Create Mobile Services

เลือก New เพื่อสร้าง Config ใหม่ และก็ Browse

Android Create Mobile Services

เลือก Project ที่ต้องการ ซึ่งก็เป็น Project ปัจจุบัน

Android Create Mobile Services

ส่วนของ Target ให้เลือก Emulator ที่เป็น Android 4.2.2 + (API 17) หรือสูงกกว่า








Android Create Mobile Services

จากนั้น App ก็จะทำการรันบน Emulator

Android Create Mobile Services

ทดสอบการเพิ่มข้อมูล

Android Create Mobile Services

ข้อมูลจะแสดงข้างล่าง

Android Create Mobile Services

ทดสอบเพิ่มรายการอื่น ๆ

Android Create Mobile Services

กลับมาที่หน้าจอ Portal Management ของ Mobile Services ให้คลิกที่เมนู DATA เราจะเห็นว่าตอนนี้ตารางที่ชื่อว่า TodoItem จะมีข้อมูลอยู่ 3 รายการ

Android Create Mobile Services

คลิกเข้าไปก็จะพบกับข้อมูล 3 รายการ ซึ่งใช้การจัดเก็บเหมือนกับ Table ทั่ว ๆ ไป ที่ประกอบด้วย Rows และ Column

หลายท่านอาจจะสงสัยว่าเราสร้าง Column ไว้ตอนไหน แล้วทำไมถึงมี 3 Column อันนี้ไม่ยากครับ เพราะการสร้างพวก Column ใน Table สามารถสร้างได้จาก Code ที่เขียนบน App สามารถอ่านและศึกษาได้จากหัวข้อถัดไป

บทความถัดไปที่แนะนำให้อ่าน




บทความที่เกี่ยวข้อง


   
Share


ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท


ลองใช้ค้นหาข้อมูล


   


Bookmark.   
       
  By : ThaiCreate.Com Team (บทความเป็นลิขสิทธิ์ของเว็บไทยครีเอทห้ามนำเผยแพร่ ณ เว็บไซต์อื่น ๆ)
  Score Rating :  
  Create/Update Date : 2013-05-08 14:08:30 / 2017-03-24 11:09:27
  Download : No files
 Sponsored Links / Related

 
ตอนที่ 1 : รู้จัก Android Mobile Services บน Windows Azure คืออะไร
Rating :

 
ตอนที่ 2 : เตรียมความพร้อมของ Android ก่อนที่จะเขียน Android กับ Mobile Services
Rating :

 
ตอนที่ 4 : การเชื่อมต่อ Android กับ Mobile Services บน Windows Azure
Rating :

 
ตอนที่ 5 : สร้าง Project บน Eclipse การเชื่อมต่อไปยัง Mobile Services ด้วย Android
Rating :

 
ตอนที่ 6 : Android สร้างตาราง Table บน Mobile Services และการ Insert ข้อมูล
Rating :

 
ตอนที่ 7 : Android อ่าน Data จาก Table ของ Mobile Services และแสดงผลบน App
Rating :

 
ตอนที่ 8 : อ่านข้อมูล Mobile Services แบบมีเงื่อนไข Where และแสดงผลบน Android
Rating :

 
ตอนที่ 9 : การทำ Authentication in Azure Mobile Services ด้วย Android
Rating :

 
ตอนที่ 10 : การทำ Push Notifications in Mobile Services ด้วย Android
Rating :

 
ตอนที่ 11 : การทำ Validate และ Modify data in Mobile Services บน Andriod
Rating :

 
ตอนที่ 12 : การทำ Refine Mobile Services queries with paging บน Android
Rating :

 
ตอนที่ 13 : การเขียน Scripts to authorize users in Mobile Services บน Android
Rating :

 
ตอนที่ 14 : Show Case 1 : Register Form (Android and Mobile Services)
Rating :

 
ตอนที่ 15 : Show Case 2 : Login User Password (Android and Mobile Services)
Rating :

 
ตอนที่ 16 : Show Case 3 : Update Data (Android and Mobile Services)
Rating :

 
ตอนที่ 17 : Show Case 4 : Delete Data (Android and Mobile Services)
Rating :

 
ตอนที่ 18 : บทความอื่น ๆ เกี่ยวกับ Android Mobile Services บน Windows Azure
Rating :


ThaiCreate.Com Forum


Comunity Forum Free Web Script
Jobs Freelance Free Uploads
Free Web Hosting Free Tools

สอน PHP ผ่าน Youtube ฟรี
สอน Android การเขียนโปรแกรม Android
สอน Windows Phone การเขียนโปรแกรม Windows Phone 7 และ 8
สอน iOS การเขียนโปรแกรม iPhone, iPad
สอน Java การเขียนโปรแกรม ภาษา Java
สอน Java GUI การเขียนโปรแกรม ภาษา Java GUI
สอน JSP การเขียนโปรแกรม ภาษา Java
สอน jQuery การเขียนโปรแกรม ภาษา jQuery
สอน .Net การเขียนโปรแกรม ภาษา .Net
Free Tutorial
สอน Google Maps Api
สอน Windows Service
สอน Entity Framework
สอน Android
สอน Java เขียน Java
Java GUI Swing
สอน JSP (Web App)
iOS (iPhone,iPad)
Windows Phone
Windows Azure
Windows Store
Laravel Framework
Yii PHP Framework
สอน jQuery
สอน jQuery กับ Ajax
สอน PHP OOP (Vdo)
Ajax Tutorials
SQL Tutorials
สอน SQL (Part 2)
JavaScript Tutorial
Javascript Tips
VBScript Tutorial
VBScript Validation
Microsoft Access
MySQL Tutorials
-- Stored Procedure
MariaDB Database
SQL Server Tutorial
SQL Server 2005
SQL Server 2008
SQL Server 2012
-- Stored Procedure
Oracle Database
-- Stored Procedure
SVN (Subversion)
แนวทางการทำ SEO
ปรับแต่งเว็บให้โหลดเร็ว


Hit Link
   







Load balance : Server 04
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่