注重体验与质量的电子书资源下载网站
分类于: 其它 设计
简介
目录
CONTENTS
INTRODUCTION xix
CHAPTER 1: INTRODUCING PHONEGAP 1
Using PhoneGap 1
Looking at a Quick Showcase 2
Taking a Basic Run-Through 5
History of PhoneGap 8
Getting to Know the Origins of PhoneGap 8
Assessing PhoneGap’s Current Status 8
Understanding What PhoneGap Is Good/Bad At 9
Understanding the Basics of a PhoneGap Application 10
What You Can Build with PhoneGap 10
Quick Overview of the API 12
Mobile Design Issues 13
Summary 15
CHAPTER 2: INSTALLING AND CONFIGURING PHONEGAP 17
Downloading PhoneGap 17
Downloading PhoneGap for iOS 18
Downloading PhoneGap for Android 20
Downloading PhoneGap for BlackBerry 22
Downloading PhoneGap for webOS 23
Downloading PhoneGap for Symbian 24
Using PhoneGap Build 25
Choosing Your Environment 27
Summary 28
CHAPTER 3: BASIC WALKTHROUGH 31
Using PhoneGap with Xcode 31
Using PhoneGap with an Android Device 36
Using PhoneGap with a BlackBerry Device 41
Using PhoneGap with Other Devices 42
Summary 42
CHAPTER 4: EVENTS 45
Understanding Events 45
Using the Events Listener 46
Understanding Event Types 47
backbutton 47
deviceready 48
menubutton 49
pause 50
resume 50
searchbutton 51
online 52
ol ine 53
Summary 56
CHAPTER 5: WORKING WITH THE DEVICE, THE NETWORK,
AND NOTIFICATIONS 59
Getting Information from the Device 59
Getting the Device Name 60
Getting the PhoneGap Version 60
Getting the Device Platform 61
Getting the Device UUID 61
Getting the Operating System Version 61
Checking for a Network 63
Determining the Connection Type 63
Using Notifi cations 66
Using Alerts 66
Using Confi rmation Dialogs 67
Using Beeps 67
Using Vibrations 68
Summary 70
CHAPTER 6: ACCELEROMETER 73
Getting to Know the Accelerometer 73
What Is the Accelerometer? 73
Using the Accelerometer 74
Showcase of Accelerometer Applications 74
Using the Acceleration Object 78
Using Accelerometer Methods 78
getCurrentAcceleration 78
watchAcceleration 79
xv
clearWatch 80
Accelerometer Option 80
Summary 82
CHAPTER 7: COMPASS 85
Getting to Know the Compass 85
What Is the Compass? 85
Dif erences among the Dif erent Devices 86
Using the Compass 88
Showcase of Compass Applications 88
Using Compass Methods 90
getCurrentHeading 90
watchHeading 91
clearWatch 92
Using a Compass Option 92
Improving the Look and Feel 94
Summary 97
CHAPTER 8: GEOLOCATION 99
Getting to Know Geolocation 99
What Is Geolocation? 99
Using Geolocation 100
Showcase of Geolocation Applications 100
The Position, PositionError, and Coordinates Objects 103
Position Object 103
PositionError Object 104
Coordinates Object 104
Using Geolocation Methods 105
getCurrentPosition 105
watchPosition 105
clearWatch 106
Using Geolocation Options 107
Improving the Look and Feel 108
Summary 110
CHAPTER 9: MEDIA 113
Learning about Media Files 113
What Are Media Files? 113
Using Media Files 114
Showcase of Media Applications 114
The Media Object 117
Using Media Methods 117
getCurrentPosition 118
getDuration 118
play 119
pause 119
release 120
startRecord 120
stop 121
Handling Errors 121
Improving the Look and Feel 125
Summary 127
CHAPTER 10: CAMERA 129
Getting to Know the Camera 129
What Is the Camera? 129
What Is the Photo Gallery? 130
Using the Camera 131
Showcase of Camera Applications 131
Using the Camera Object 133
Using the getPicture Method 133
Using Camera Options 135
Improving the Look and Feel 138
Summary 141
CHAPTER 11: STORAGE 143
Learning about Storage Options 143
Using the Database Object 146
Opening a Database 146
Running a SQL Query 147
Viewing a Result Set 148
Handling Errors 149
Using the localStorage Object 152
Summary 155
CHAPTER 12: FILES 157
Learning about Filesystems 157
Learning about Directories and Files 158
Using the DirectoryEntry Object 158
Using the FileEntry Object 164
xvii
Using Flags 168
Using LocalFileSystem 168
Reading Files 169
abort 170
readAsDataURL 170
readAsText 170
Writing Files 171
Learning about Transferring Files 172
FileUploadOptions 173
FileUploadResults 173
Handling Errors 173
FileError 174
FileTransferError 174
Summary 176
CHAPTER 13: CONTACTS 179
Learning about Creating Contacts 179
Saving a Contact 181
Cloning a Contact 182
Removing a Contact 182
Finding a Contact 182
Understanding Some Quirks 183
Contacts 183
ContactName 184
ContactOrganization 185
Handling Errors 186
Summary 187
CHAPTER 14: CAPTURE 189
Learning about Capturing Video 189
Using the options Argument 190
Recognizing Quirks when Capturing Videos 190
Learning about Capturing Audio 191
Using the options Argument 191
Recognizing Quirks when Capturing Audio 192
Learning about Capturing Images 192
Using the options Argument 193
Recognizing Quirks when Capturing Images 193
Handling Errors 193
Summary 195
CHAPTER 15: CREATING A NOTE-TAKING APPLICATION 197
Designing the Application 197
Building the Application 198
Creating the Capture Options 198
Adding Metadata 202
Saving and Synching 203
Adding Geolocation 206
The Final Code 207
Cleaning Up the App 210
Summary 210
APPENDIX A: ANSWERS TO EXERCISES 213
APPENDIX B: TOOLS FOR PHONEGAP 235
APPENDIX C: PHONEGAP.JS 247
APPENDIX D: PHONEGAP PLUG-INS 333
INDEX 349
INTRODUCTION xix
CHAPTER 1: INTRODUCING PHONEGAP 1
Using PhoneGap 1
Looking at a Quick Showcase 2
Taking a Basic Run-Through 5
History of PhoneGap 8
Getting to Know the Origins of PhoneGap 8
Assessing PhoneGap’s Current Status 8
Understanding What PhoneGap Is Good/Bad At 9
Understanding the Basics of a PhoneGap Application 10
What You Can Build with PhoneGap 10
Quick Overview of the API 12
Mobile Design Issues 13
Summary 15
CHAPTER 2: INSTALLING AND CONFIGURING PHONEGAP 17
Downloading PhoneGap 17
Downloading PhoneGap for iOS 18
Downloading PhoneGap for Android 20
Downloading PhoneGap for BlackBerry 22
Downloading PhoneGap for webOS 23
Downloading PhoneGap for Symbian 24
Using PhoneGap Build 25
Choosing Your Environment 27
Summary 28
CHAPTER 3: BASIC WALKTHROUGH 31
Using PhoneGap with Xcode 31
Using PhoneGap with an Android Device 36
Using PhoneGap with a BlackBerry Device 41
Using PhoneGap with Other Devices 42
Summary 42
CHAPTER 4: EVENTS 45
Understanding Events 45
Using the Events Listener 46
Understanding Event Types 47
backbutton 47
deviceready 48
menubutton 49
pause 50
resume 50
searchbutton 51
online 52
ol ine 53
Summary 56
CHAPTER 5: WORKING WITH THE DEVICE, THE NETWORK,
AND NOTIFICATIONS 59
Getting Information from the Device 59
Getting the Device Name 60
Getting the PhoneGap Version 60
Getting the Device Platform 61
Getting the Device UUID 61
Getting the Operating System Version 61
Checking for a Network 63
Determining the Connection Type 63
Using Notifi cations 66
Using Alerts 66
Using Confi rmation Dialogs 67
Using Beeps 67
Using Vibrations 68
Summary 70
CHAPTER 6: ACCELEROMETER 73
Getting to Know the Accelerometer 73
What Is the Accelerometer? 73
Using the Accelerometer 74
Showcase of Accelerometer Applications 74
Using the Acceleration Object 78
Using Accelerometer Methods 78
getCurrentAcceleration 78
watchAcceleration 79
xv
clearWatch 80
Accelerometer Option 80
Summary 82
CHAPTER 7: COMPASS 85
Getting to Know the Compass 85
What Is the Compass? 85
Dif erences among the Dif erent Devices 86
Using the Compass 88
Showcase of Compass Applications 88
Using Compass Methods 90
getCurrentHeading 90
watchHeading 91
clearWatch 92
Using a Compass Option 92
Improving the Look and Feel 94
Summary 97
CHAPTER 8: GEOLOCATION 99
Getting to Know Geolocation 99
What Is Geolocation? 99
Using Geolocation 100
Showcase of Geolocation Applications 100
The Position, PositionError, and Coordinates Objects 103
Position Object 103
PositionError Object 104
Coordinates Object 104
Using Geolocation Methods 105
getCurrentPosition 105
watchPosition 105
clearWatch 106
Using Geolocation Options 107
Improving the Look and Feel 108
Summary 110
CHAPTER 9: MEDIA 113
Learning about Media Files 113
What Are Media Files? 113
Using Media Files 114
Showcase of Media Applications 114
The Media Object 117
Using Media Methods 117
getCurrentPosition 118
getDuration 118
play 119
pause 119
release 120
startRecord 120
stop 121
Handling Errors 121
Improving the Look and Feel 125
Summary 127
CHAPTER 10: CAMERA 129
Getting to Know the Camera 129
What Is the Camera? 129
What Is the Photo Gallery? 130
Using the Camera 131
Showcase of Camera Applications 131
Using the Camera Object 133
Using the getPicture Method 133
Using Camera Options 135
Improving the Look and Feel 138
Summary 141
CHAPTER 11: STORAGE 143
Learning about Storage Options 143
Using the Database Object 146
Opening a Database 146
Running a SQL Query 147
Viewing a Result Set 148
Handling Errors 149
Using the localStorage Object 152
Summary 155
CHAPTER 12: FILES 157
Learning about Filesystems 157
Learning about Directories and Files 158
Using the DirectoryEntry Object 158
Using the FileEntry Object 164
xvii
Using Flags 168
Using LocalFileSystem 168
Reading Files 169
abort 170
readAsDataURL 170
readAsText 170
Writing Files 171
Learning about Transferring Files 172
FileUploadOptions 173
FileUploadResults 173
Handling Errors 173
FileError 174
FileTransferError 174
Summary 176
CHAPTER 13: CONTACTS 179
Learning about Creating Contacts 179
Saving a Contact 181
Cloning a Contact 182
Removing a Contact 182
Finding a Contact 182
Understanding Some Quirks 183
Contacts 183
ContactName 184
ContactOrganization 185
Handling Errors 186
Summary 187
CHAPTER 14: CAPTURE 189
Learning about Capturing Video 189
Using the options Argument 190
Recognizing Quirks when Capturing Videos 190
Learning about Capturing Audio 191
Using the options Argument 191
Recognizing Quirks when Capturing Audio 192
Learning about Capturing Images 192
Using the options Argument 193
Recognizing Quirks when Capturing Images 193
Handling Errors 193
Summary 195
CHAPTER 15: CREATING A NOTE-TAKING APPLICATION 197
Designing the Application 197
Building the Application 198
Creating the Capture Options 198
Adding Metadata 202
Saving and Synching 203
Adding Geolocation 206
The Final Code 207
Cleaning Up the App 210
Summary 210
APPENDIX A: ANSWERS TO EXERCISES 213
APPENDIX B: TOOLS FOR PHONEGAP 235
APPENDIX C: PHONEGAP.JS 247
APPENDIX D: PHONEGAP PLUG-INS 333
INDEX 349