1. Trang chủ
  2. » Công Nghệ Thông Tin

Tài liệu Building OpenSocial Apps- P1 doc

50 252 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

ptg From the Library of Lee Bogdanoff Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. ptg Building OpenSocial Apps From the Library of Lee Bogdanoff Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. ptg T he Developer’s Library Series from Addison-Wesley provides practicing programmers with unique, high-quality references and tutorials on the latest programming languages and technologies they use in their daily work. All books in the Developer’s Library are written by expert technology practitioners who are exceptionally skilled at organizing and presenting information in a way that’s useful for other programmers. Developer’s Library books cover a wide range of topics, from open- source programming languages and databases, Linux programming, Microsoft, and Java, to Web development, social networking platforms, Mac/iPhone programming, and Android programming. Visit developers-library.com for a complete list of available products Developer’s Library Series From the Library of Lee Bogdanoff Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. ptg Building OpenSocial Apps A Field Guide to Working with the MySpace Platform Chris Cole Chad Russell Jessica Whyte Upper Saddle River, NJ • Boston • Indianapolis • San Francisco New York • Toronto • Montreal • London • Munich • Paris • Madrid Capetown • Sydney • Tokyo • Singapore • Mexico City From the Library of Lee Bogdanoff Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. ptg Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals. The screenshots and other depictions of myspace.com contained in this book may not accurately represent myspace.com as it exists today or in the future, including without limitation with respect to any policies, technical specs or product design. The authors and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein. The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests. For more information, please contact: U.S. Corporate and Government Sales (800) 382-3419 corpsales@pearsontechgroup.com For sales outside the United States, please contact: International Sales international@pearson.com Visit us on the Web: informit.com/aw Library of Congress Cataloging-in-Publication Data Cole, Chris, 1974- Building OpenSocial apps : a field guide to working with the MySpace platform/Chris Cole, Chad Russell, Jessica Whyte. p. cm. Includes bibliographical references and index. ISBN-13: 978-0-321-61906-8 (pbk. : alk. paper) ISBN-10: 0-321-61906-4 (pbk. : alk. paper) 1. Entertainment computing. 2. Internet programming. 3. MySpace.com. 4. OpenSocial. 5. Web site development. 6. Social networks—Computer network resources. 7. Application program interfaces (Computer software) I. Russell, Chad. II. Whyte, Jessica. III. Title. QA76.9.E57C65 2010 006.7'54—dc22 2009032342 Copyright © 2010 Pearson Education, Inc. All rights reserved. Printed in the United States of America. This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permissions, write to: Pearson Education, Inc Rights and Contracts Department 501 Boylston Street, Suite 900 Boston, MA 02116 Fax: (617) 671-3447 ISBN-13: 978-0-321-61906-8 ISBN-10: 0-321-61906-4 Text printed in the United States on recycled paper at RR Donnelley in Crawfordsville, Indiana. First printing, October 2009 Editor-in-Chief Mark L. Taub Acquisitions Editor Trina MacDonald Development Editor Songlin Qiu Managing Editor John Fuller Full-Service Production Manager Julie B. Nahil Project Management diacriTech LLC Copy Editor Barbara Wood Indexer Jack Lewis Proofreader George Seki Technical Reviewers Cassie Doll Bess Ho Benjamin Schupak Book Designer Gary Adair Compositor diacriTech LLC From the Library of Lee Bogdanoff Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. ptg ❖ This book is dedicated to my ever-suffering wife, Kristen, and our two crazy and wonderful children, Darien and Reece.Thanks for working overtime with the kids, baby . —Chris Cole To the reader, we hope this book serves you well. —Chad Russell and Jessica Whyte ❖ From the Library of Lee Bogdanoff Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. ptg Contents at a Glance Contents viii Foreword xvi Acknowledgments xviii About the Authors xix Introduction xxi I: Building Your First MySpace Application 1 Your First MySpace App 3 2 Getting Basic MySpace Data 9 3 Getting Additional MySpace Data 29 4 Persisting Information 47 5 Communication and Viral Features 67 6 Mashups and External Server Communications 91 7 Flushing and Fleshing: Expanding Your App and Person-to-Person Game Play 117 II: Other Ways to Build Apps 8 OAuth and Phoning Home 153 9 External Iframe Apps 177 10 OSML, Gadgets, and the Data Pipeline 213 11 Advanced OSML: Templates, Internationalization, and View Navigation 239 III: Growth and How to Deal with It 12 App Life Cycle 265 13 Performance, Scaling, and Security 283 From the Library of Lee Bogdanoff Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. ptg viivii 14 Marketing and Monetizing 305 15 Porting Your App to OpenSocial 0.9 329 References 351 Index 355 Contents at a Glance From the Library of Lee Bogdanoff Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. ptg Contents Foreword xvi Acknowledgments xviii About the Authors xix Introduction xxi I: Building Your First MySpace Application 1 Your First MySpace App 3 Creating the App—“Hello World” 3 Step 1: Sign Up for a Developer Account 3 Step 2: Create an App 4 Step 3: Enter Your Source Code 4 Installing and Running Your App 7 Summary 7 2 Getting Basic MySpace Data 9 The Two Concepts That Every Developer Should Know 9 Basic Concepts: Owner and Viewer 9 Basic Concepts: Permissions for Accessing MySpace Data 10 Starting Our Tic-Tac-Toe App 10 Accessing MySpace User Data 11 Accessing Profile Information Using the opensocial.Person Object 15 Getting More than Just the Default Profile Data 18 opensocial.DataResponse and opensocial. ResponseItem (aka, Using MySpace User Data) 19 Error Handling 24 Summary 27 3 Getting Additional MySpace Data 29 How to Fetch a Friend List and Make Use of the Data 29 Getting the Friend List 30 Filters and Sorts 31 From the Library of Lee Bogdanoff Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. ptg ix Contents Paging 32 Using the Data 37 Fetching Media 39 Photos 39 Albums and Videos 41 Using opensocial.requestPermission and opensocial.hasPermission to Check a User’s Permission Settings 43 Summary 45 4 Persisting Information 47 App Data Store 47 Saving and Retrieving Data 48 Refactoring to Build a Local App Data Store 51 Cookies 56 Why You Shouldn’t Use Cookies 57 Building the Cookie Jacker App 59 Third-Party Database Storage 64 Summary 65 5 Communication and Viral Features 67 Using opensocial.requestShareApp to Spread Your App to Other Users 67 Defining requestShareApp 70 Writing the requestShareApp Code 71 Calling requestShareApp 72 The requestShareApp Callback 72 Using opensocial.requestSendMessage to Send Messages and Communications 74 Defining requestSendMessage 75 Writing the requestSendMessage Code 76 Callback in requestSendMessage 78 Getting Your App Listed on the Friend Updates with opensocial.requestCreateActivity Basics 79 Defining opensocial.requestCreateActivity 79 Using the Template System to Create Activities 80 Data Types 80 Reserved Variable Names 81 Aggregation 82 From the Library of Lee Bogdanoff Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. [...]... OpenID, a global identity standard; and OpenSocial, a common API for building applications.These specifications are becoming the underlying infrastructure for the social Web, weaving a social fabric throughout the Web OpenSocial enables developers to learn a single core programming model that can be applied to all OpenSocial containers,” those sites that support the OpenSocial specification.With standards-based... available when building with the OpenSocial API, and the code is open source for ease of use and future reference Additionally, the MySpace Platform tips sprinkled throughout will help you avoid common mistakes and understand the intricacies of their platform policies Getting a feel for how social platforms operate will be valuable as you continue to explore the wide world of OpenSocial OpenSocial is... programming methodologies and improvements that make it easier for new developers to start using OpenSocial As you’re getting into the OpenSocial API, be sure to contribute back to the OpenSocial. org community your ideas on how to improve the specification It’s open It’s social It’s up to you —Dan Peterson, president, OpenSocial Foundation San Francisco, California August 2009 Please purchase PDF Split-Merge... Bogdanoff About the Authors Chris Cole is a software architect at MySpace and is a major contributor to building the MySpace Open Platform and keeping it committed to OpenSocial He’s been a core contributor to the OpenSocial 0.9 specification and is the primary architect and implementer of OSML (OpenSocial Markup Language) on the MySpace platform Chris has been in software for fifteen years and has... implement the OpenSocial spec.The idea is that when a site becomes OpenSocial- compliant, it is able to run almost any of the thousands of apps already created using OpenSocial If a site has correctly implemented all the various APIs, an app running on MySpace should run just as well anywhere else.That’s the theory, anyway In practice there are differences, some small, some large, between the various OpenSocial. .. MySpace users In this book we’ll start from scratch and walk you through the entire process of building apps, from signing up as a developer all the way to building highly complex social apps that can scale out to thousands of users.We have extensive experience on the MySpace Development Platform (MDP), from building apps to helping build the platform itself.We’ll point out the many idiosyncrasies and... You sign up, bling out your Profile, add some friends, upload some pictures, install some apps, and send some messages What Is OpenSocial? OpenSocial is a specification that defines how Web sites allow third-party apps to run on their sites.That means many things For example, OpenSocial defines what information a Web site can and must expose for each of its users It defines a client-side JavaScript runtime... more than 50 sites have implemented support for the OpenSocial specification In aggregate, these sites provide developers with access to more than 750 million users all over the world By taking advantage of the OpenSocial API and the information available in this book, you will have a great opportunity to reach a lot of users For example, you’ll find the OpenSocial API supported by many major sites that... throughout this book),“apps” as they a writing OpenSocial applications (or are commonly known as we’ll but with a focus on the MySpace platform This first chapter is designed to give you an overview of what to expect from developing with OpenSocial for MySpace.To do that, we’ll start with a “Hello World” app, something simple to introduce you to MySpace and OpenSocial As we make our way through Chapter... a lot more complexity Now, let’s enter the following “Hello World” code and run it: OpenSocial Hello World var viewer = null; /** * Initial data request to load Viewer */ function getViewerData(){ var req = opensocial. newDataRequest(); req.add(req.newFetchPersonRequest( opensocial. IdSpec.PersonId.VIEWER), "viewer"); req.send(getDataCallback); } /** * Callback . Information Using the opensocial. Person Object 15 Getting More than Just the Default Profile Data 18 opensocial. DataResponse and opensocial. ResponseItem. continue to explore the wide world of OpenSocial. OpenSocial is constantly evolving, just like the rest of the Internet.The OpenSocial specification is managed

Ngày đăng: 24/12/2013, 06:17

Xem thêm: Tài liệu Building OpenSocial Apps- P1 doc

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN