100% found this document useful (2 votes)
28 views

Asynchronous Android Programming 2nd Edition Helder Vasconcelos pdf download

Asynchronous Android Programming, 2nd Edition by Helder Vasconcelos, focuses on building responsive Android applications using multi-core mobile devices. The book covers various asynchronous programming techniques, including the use of AsyncTask, Looper, and Handler, to manage concurrency and maintain UI responsiveness. It provides step-by-step guidelines and code examples to help developers avoid common pitfalls in multithreaded programming.

Uploaded by

zaaraagbota
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
28 views

Asynchronous Android Programming 2nd Edition Helder Vasconcelos pdf download

Asynchronous Android Programming, 2nd Edition by Helder Vasconcelos, focuses on building responsive Android applications using multi-core mobile devices. The book covers various asynchronous programming techniques, including the use of AsyncTask, Looper, and Handler, to manage concurrency and maintain UI responsiveness. It provides step-by-step guidelines and code examples to help developers avoid common pitfalls in multithreaded programming.

Uploaded by

zaaraagbota
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 55

Asynchronous Android Programming 2nd Edition

Helder Vasconcelos pdf download

https://ebookfinal.com/download/asynchronous-android-
programming-2nd-edition-helder-vasconcelos/

Explore and download more ebooks or textbooks


at ebookfinal.com
We have selected some products that you may be interested in
Click the link to download now or visit ebookfinal.com
for more options!.

Android Programming Tutorials 3rd Edition Mark L Murphy

https://ebookfinal.com/download/android-programming-tutorials-3rd-
edition-mark-l-murphy/

Professional Android Sensor Programming 1st Edition Greg


Milette

https://ebookfinal.com/download/professional-android-sensor-
programming-1st-edition-greg-milette/

Reactive Programming with RxJS Untangle Your Asynchronous


JavaScript Code 1st Edition Sergi Mansilla

https://ebookfinal.com/download/reactive-programming-with-rxjs-
untangle-your-asynchronous-javascript-code-1st-edition-sergi-mansilla/

The Android Developer s Cookbook 2nd edition Building


Applications with the Android SDK Ronan Schwarz

https://ebookfinal.com/download/the-android-developer-s-cookbook-2nd-
edition-building-applications-with-the-android-sdk-ronan-schwarz/
Android Application Development For Dummies 2nd Edition
Michael Burton

https://ebookfinal.com/download/android-application-development-for-
dummies-2nd-edition-michael-burton/

Handbook of Asynchronous Machines with Variable Speed 1st


Edition Hubert Razik

https://ebookfinal.com/download/handbook-of-asynchronous-machines-
with-variable-speed-1st-edition-hubert-razik/

A Designer s Guide to Asynchronous VLSI 1st Edition Peter


A. Beerel

https://ebookfinal.com/download/a-designer-s-guide-to-asynchronous-
vlsi-1st-edition-peter-a-beerel/

Programming in Haskell 2nd Edition Graham Hutton

https://ebookfinal.com/download/programming-in-haskell-2nd-edition-
graham-hutton/

Programming in Lua 2nd Edition Roberto Ierusalimschy

https://ebookfinal.com/download/programming-in-lua-2nd-edition-
roberto-ierusalimschy/
Asynchronous Android Programming 2nd Edition Helder
Vasconcelos Digital Instant Download
Author(s): Helder Vasconcelos
ISBN(s): 9781785883248, 1785883240
Edition: 2nd
File Details: PDF, 2.30 MB
Year: 2016
Language: english
[1]
Asynchronous Android
Programming
Second Edition

Unlock the power of multi-core mobile devices to build


responsive and reactive Android applications

Helder Vasconcelos

BIRMINGHAM - MUMBAI
Asynchronous Android Programming
Second Edition

Copyright © 2016 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy
of the information presented. However, the information contained in this book is
sold without warranty, either express or implied. Neither the author, nor Packt
Publishing, and its dealers and distributors will be held liable for any damages
caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.

First published: July 2016

Production reference: 1260716

Published by Packt Publishing Ltd.


Livery Place
35 Livery Street
Birmingham B3 2PB, UK.

ISBN 978-1-78588-324-8

www.packtpub.com
Credits

Author Project Coordinator


Helder Vasconcelos Nidhi Joshi

Reviewer Proofreader
Gavin Matthews Safis Editing

Commissioning Editor Indexer


Edward Gordon Mariammal Chettiyar

Acquisition Editor Graphics


Indrajit Das Disha Haria

Content Development Editor Production Coordinator


Siddhesh Salvi Arvindkumar Gupta

Technical Editor Cover Work


Danish Shaikh Arvindkumar Gupta

Copy Editor
Vibha Shukla
About the Author

Helder Vasconcelos is a Portuguese Software Engineer based on Dublin,


Ireland, with more than 10 years of experience designing and developing
real-time/multithreaded Java and C++ applications for the telecommunications
and aviation industries. Apart from his day-to-day job, he occupies his spare
time building native Android applications for Bearstouch Software and
other third-party companies.

He graduated with a degree in Electronic and Telecommunications Engineering


from the University of Aveiro in January 2006. During his career, he has worked
as a Software Engineer for companies such as PT Inovação (Portugal), Airtel ATN
(Dublin, Ireland) and Axway (Dublin, Ireland). You can find Hélder on LinkedIn
at (https://ie.linkedin.com/in/heldervasc/en) or on his website at
(http://hvasconcelos.github.io).

I would like to sincerely thanks all technical reviewers, but especially


Gavin. I really appreciate your invaluable feedback and commit that
shaped the quality of the book. A special thanks to my awesome wife
Tania for encourage me when the lack of motivation was killing my
productivity. It would not have been possible without your precious
support. Thanks also to my parents and family for their awesome
effort in my education. Additionally, I would like to thank my
friends, colleagues, clients, and teachers for helping me to shape and
improve my skills and perspectives during my career.
About the Reviewer

Gavin Matthews is a veteran software engineer specializing in enterprise scale


B2B, MFT and EFSS systems.
www.PacktPub.com

eBooks, discount offers, and more


Did you know that Packt offers eBook versions of every book published, with PDF
and ePub files available? You can upgrade to the eBook version at www.PacktPub.
com and as a print book customer, you are entitled to a discount on the eBook copy.
Get in touch with us at customercare@packtpub.com for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign
up for a range of free newsletters and receive exclusive discounts and offers on Packt
books and eBooks.
TM

https://www2.packtpub.com/books/subscription/packtlib

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital
book library. Here, you can search, access, and read Packt's entire library of books.

Why subscribe?
• Fully searchable across every book published by Packt
• Copy and paste, print, and bookmark content
• On demand and accessible via a web browser
Table of Contents
Preface vii
Chapter 1: Asynchronous Programming in Android 1
Android software stack 2
Dalvik runtime 2
ART runtime 3
Memory sharing and Zygote 4
Android process model 5
Process ranks 5
Process sandboxing 6
Android thread model 6
The main thread 7
The Application Not Responding (ANR) dialog 9
Maintaining responsiveness 10
Concurrency in Android 12
Correctness issues in concurrent programs 14
Liveness issues in concurrent programs 16
Thread coordination 16
Concurrent package constructs 19
Executor framework 20
Android primary building blocks 21
Activity concurrent issues 21
Manipulating the user interface 23
Service concurrent issues 25
Started services issues 25
Bound services issues 26
Service in a separate process 27
Broadcast receiver concurrent issues 28
Android concurrency constructs 28
Summary 29
[i]
Table of Contents

Chapter 2: Performing Work with Looper, Handler,


and HandlerThread 31
Understanding Looper 32
Understanding Handler 34
Sending work to a Looper 37
Scheduling work with post 39
Using Handler to defer work 40
Leaking implicit references 41
Leaking explicit references 43
Updating the UI with Handler 45
Canceling a pending Runnable 46
Scheduling work with send 47
Cancelling pending messages 50
Composition versus inheritance 52
Multithreading with Handler and ThreadHandler 53
Looper message dispatching debugging 58
Sending messages versus posting runnables 59
Applications of Handler and HandlerThread 59
Summary 60
Chapter 3: Exploring the AsyncTask 61
Introducing AsyncTask 62
Declaring AsyncTask types 65
Executing AsyncTasks 67
Providing indeterministic progress feedback 69
Providing deterministic progress feedback 72
Canceling an AsyncTask 75
AsyncTask Execution State 78
Handling exceptions 79
Controlling the level of concurrency 81
Common AsyncTask issues 84
Fragmentation issues 84
Memory leaks 85
Activity lifecycle issues 85
Handling lifecycle issues with early cancellation 86
Handling lifecycle issues with retained headless fragments 87
Applications of AsyncTask 92
Summary 93
Chapter 4: Exploring the Loader 95
Introducing Loaders 96
Loader API 96
Loader 97

[ ii ]
Table of Contents

Loader Manager 98
LoaderManager.LoaderCallbacks 99
Loader lifecycle 100
Loading data with Loader 101
Building responsive apps with AsyncTaskLoader 107
Building responsive apps with CursorLoader 116
Combining Loaders 119
Applications of Loader 125
Summary 125
Chapter 5: Interacting with Services 127
Introducing Service 128
Started service 131
Building responsive apps with IntentService 136
Handling results 139
Posting results with PendingIntent 139
Posting results as system notifications 142
Applications of IntentService 143
HTTP uploads with IntentService 144
Reporting progress 146
Bound Service 149
Communicating with a Local Service 150
Broadcasting results with intents 158
Detecting unhandled broadcasts 160
Applications of Services 163
Summary 164
Chapter 6: Scheduling Work with AlarmManager 165
Introducing AlarmManager 166
Scheduling alarms with AlarmManager 167
Setting alarms in recent Android versions 169
Testing your alarms in Doze Mode 172
Setting a Window alarm 173
Debugging AlarmManager alarms 173
Canceling alarms 175
Scheduling repeating alarms 176
Scheduling an alarm clock 178
Handling alarms 179
Handling alarms with Activities 180
Handling alarms with BroadcastReceiver 181
Working with BroadcastReceiver 183
Asynchronous work with goAsync 186

[ iii ]
Table of Contents

Handling alarms with Services 187


Staying awake with WakeLocks 188
Resetting alarms after a system reboot 190
Applications of AlarmManager 192
Summary 192
Chapter 7: Exploring the JobScheduler API 195
Introduction to JobScheduler 196
Setting running criteria 197
Scheduling a job 200
Implementing the JobService 203
Listing pending jobs 208
Canceling a job 211
Scheduling a periodic job 211
Applications of the JobScheduler 212
Summary 213
Chapter 8: Interacting with the Network 215
Introducing Android HTTP clients 216
AndroidHttpClient 217
HttpURLConnection 218
Performing HTTP requests asynchronously 218
Retrieving a text response 225
Interacting with JSON web APIs 227
Converting Java objects to JSON 228
Interacting with XML web APIs 234
Converting Java objects to XML 235
Converting XML to Java objects 237
Customizing HTTP timeouts 241
Communicating securely over SSL sessions 243
Summary 251
Chapter 9: Asynchronous Work on the Native Layer 253
Introduction to JNI 254
Android NDK (Native Development Kit) 255
Calling C functions from Java code 256
Calling C++ functions from native code 260
Accessing Java objects from native code 262
Executing native background work on Java threads 265
Executing asynchronous work on a native thread 270
Attaching and detaching native threads from JVM 270
JNI references explained 276
Interacting with UI from native threads 277

[ iv ]
Table of Contents

Starting the native threads 279


Stopping the native threads 279
Handling Java exceptions in the native layer 280
Interacting with a Java monitor from native code 283
Wrapping native data objects 287
Summary 291
Chapter 10: Network Interactions with GCM 293
Introduction to GCM 294
Setting up and configuring GCM for your application 296
Registering the GCM Receiver 298
Setting up a registration service 298
InstanceID listener 300
Receiving downstream messages 302
Receiving messages from topic 306
Sending upstream messages 310
GcmListenerService delivery callbacks 314
Executing tasks with GCM Network Manager 315
Building a one shot task 316
Summary 320
Chapter 11: Exploring Bus-based Communications 321
Introduction to bus-based communication 322
EventBus library 323
Defining events 324
Submitting events 325
Registering sbscribers 326
Thread mode 327
Posting sticking events 334
Removing sticky events 338
Summary 339
Chapter 12: Asynchronous Programing with RxJava 341
Introduction to RxJava 342
Cold versus Hot Observable 344
RxJava setup 344
Creating Observables 344
Transforming Observables 347
Understanding Schedulers 349
Performing IO operations with Schedulers 351
Canceling subscriptions 354
Composing Observables 354
Monitoring the event stream 356

[v]
Table of Contents

Combining Observables 359


Observing UI Events with RxJava 362
Working with Subjects 366
Summary 369
Index 371

[ vi ]
Preface
Whether you are Android beginner developer or an Android seasoned programmer,
this book will explore how to achieve efficient and reliable multithreaded Android
applications.

We'll look at best asynchronous constructs and techniques, commonly used by


Android Developer community, to execute computation intensive or blocking tasks
off the main thread, keeping the UI responsive, telling the user how things are going,
making sure we finish what we started, using those powerful multicore processors,
and doing it all without wasting the battery.

By using the right asynchronous construct, much of the complexity is abstracted


from the developer, making the application source code more readable and
maintainable and less error prone.

Using step-by-step guidelines and code examples, you will learn how manage
interactions between several threads and avoid concurrency and synchronization
problems that might occur when two or more threads access a shared resource to
complete a background job, to update the UI or retrieve the latest application data.

At the end of this journey you will know how build well-behaved applications with
smooth, responsive user-interfaces that delight users with speedy results and data
that's always fresh.

What this book covers


Chapter 1, Asynchronous Programming in Android, gives an overview of the Android
process and thread model, and describes some of the challenges and benefits of
concurrency in general, before discussing issues specific to Android.

[ vii ]
Preface

Chapter 2, Performing Work with Looper, Handler and HandlerThread details the
fundamental and related topics of Handler, HandlerThread, and Looper, and
illustrates how they can be used to schedule tasks on the main thread, and to
coordinate and communicate work between cooperating background threads.

Chapter 3, Exploring the AsyncTask, covers the most common concurrent construct of
programming in Android. We learn how AsyncTask works, how to use it correctly,
and how to avoid the common pitfalls that catch out even experienced developers.

Chapter 4, Exploring the Loader, introduces the Loader framework and tackles the
important task of loading data asynchronously to keep the user interface responsive
and glitch free.

Chapter 5, Interacting with Services, we explored the very powerful Service Android
component, putting it to use to execute long-running background tasks with or
without a configurable level of concurrency. This component gives us the means to
perform background operations beyond the scope of a single Activity lifecycle and
to ensure that our work is completed even if the user leaves the application.

Chapter 6, Scheduling Work with AlarmManager, introduces to us a system API that


could be used to defer work or create periodic tasks. The scheduled task could wake
up the device to complete the work or alert users to new content.

Chapter 7, Exploring the JobScheduler API, covers a job scheduling system API
introduced with Android Lollipop that allows us to start background work
when a set of device conditions, such as energy or network, are fulfilled.

Chapter 8, Interacting with the Network, we cover in detail HttpUrlConnection


Android HTTP client. With the HttpUrlConnection HTTP client, we will create
an asynchronous toolkit that is able to fetch JSON documents, XML or text from a
remote server.

Chapter 9, Asynchronous Work on the Native layer, introduces the JNI interface, an
Java standard interface that will allow us to execute concurrent tasks on native
code (C/C++), interact with the Java code from the native layer or update the
UI from the native code.

Chapter 10, Network Interactions with GCM, we will learn how to use the Google GCM
to efficiently push and pull efficiently realtime messages from your server and how
to schedule work with Google Play Services framework.

Chapter 11, Exploring Bus-based Communications, we will introduce to the reader the
publish-subscribe messaging pattern and the Event Bus Library, a publish-subscribe
implementation that allow us to deliver asynchronous messages between Android
application components.

[ viii ]
Preface

Chapter 12, Asynchronous Programing with RxJava, we will introduce RxJava, a library
used to easily compose asynchronous and event-based tasks on Java by using
observable data streams.

What you need for this book


To follow along and experiment with the examples, you will need a development
computer with a Java 7 (or 8) SE Development Kit and the Android Software
Development Kit Version 9 or above (you will need at least Version 21 to try all of
the examples).

You will also need Android Studio IDE. The examples have been developed using
Google's new Android Studio IDE and use its integrated build system, Gradle.

While you can run the examples using the emulator provided by the Android SDK, it
is a poor substitute for the real thing. A physical Android device is a much faster and
more pleasurable way to develop and test Android applications!

Many of the examples will work on a device running any version of Android since
2.3, GingerBread. Some examples demonstrate newer APIs and as a result, require a
more recent Android version—up to Android 5, Lollipop.

Who this book is for


This book is for Android Developers who want to learn how to build multithreaded
and reliable Android applications using high level and advanced asynchronous
techniques and concepts.

They want to learn this technology because they want learn how to build efficient
applications that are able to interact orderly with internal/external services and
frameworks using Android standard constructs and APIs.

No prior knowledge of of concurrent and asynchronous programming is required.


This book is also targeted towards Java experts who are new to Android.

Conventions
In this book, you will find a number of text styles that distinguish between different
kinds of information. Here are some examples of these styles and an explanation of
their meaning.

[ ix ]
Preface

Code words in text, database table names, folder names, filenames, file extensions,
pathnames, dummy URLs, user input, and Twitter handles are shown as follows:
"We can include other contexts through the use of the include directive."

A block of code is set as follows:


[default]
exten => s,1,Dial(Zap/1|30)
exten => s,2,Voicemail(u100)
exten => s,102,Voicemail(b100)
exten => i,1,Voicemail(s0)

When we wish to draw your attention to a particular part of a code block, the
relevant lines or items are set in bold:
[default]
exten => s,1,Dial(Zap/1|30)
exten => s,2,Voicemail(u100)
exten => s,102,Voicemail(b100)
exten => i,1,Voicemail(s0)

Any command-line input or output is written as follows:


# cp /usr/src/asterisk-addons/configs/cdr_mysql.conf.sample
/etc/asterisk/cdr_mysql.conf

New terms and important words are shown in bold. Words that you see on the
screen, for example, in menus or dialog boxes, appear in the text like this: "Clicking
the Next button moves you to the next screen."

Warnings or important notes appear in a box like this.

Tips and tricks appear like this.

Reader feedback
Feedback from our readers is always welcome. Let us know what you think about
this book—what you liked or disliked. Reader feedback is important for us as it helps
us develop titles that you will really get the most out of.

[x]
Preface

To send us general feedback, simply e-mail feedback@packtpub.com, and mention


the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing
or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support
Now that you are the proud owner of a Packt book, we have a number of things to
help you to get the most from your purchase.

Downloading the example code


You can download the example code files for this book from your account at
http://www.packtpub.com. If you purchased this book elsewhere, you can visit
http://www.packtpub.com/support and register to have the files e-mailed directly
to you.

You can download the code files by following these steps:

1. Log in or register to our website using your e-mail address and password.
2. Hover the mouse pointer on the SUPPORT tab at the top.
3. Click on Code Downloads & Errata.
4. Enter the name of the book in the Search box.
5. Select the book for which you're looking to download the code files.
6. Choose from the drop-down menu where you purchased this book from.
7. Click on Code Download.

You can also download the code files by clicking on the Code Files button on the
book's webpage at the Packt Publishing website. This page can be accessed by
entering the book's name in the Search box. Please note that you need to be logged in
to your Packt account.

Once the file is downloaded, please make sure that you unzip or extract the folder
using the latest version of:

• WinRAR / 7-Zip for Windows


• Zipeg / iZip / UnRarX for Mac
• 7-Zip / PeaZip for Linux

[ xi ]
Preface

The code bundle for the book is also hosted on GitHub at https://github.com/
PacktPublishing/Asynchronous-Android-Programming. We also have other code
bundles from our rich catalog of books and videos available at https://github.
com/PacktPublishing/. Check them out!

Errata
Although we have taken every care to ensure the accuracy of our content, mistakes
do happen. If you find a mistake in one of our books—maybe a mistake in the text or
the code—we would be grateful if you could report this to us. By doing so, you can
save other readers from frustration and help us improve subsequent versions of this
book. If you find any errata, please report them by visiting http://www.packtpub.
com/submit-errata, selecting your book, clicking on the Errata Submission Form
link, and entering the details of your errata. Once your errata are verified, your
submission will be accepted and the errata will be uploaded to our website or added
to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/


content/support and enter the name of the book in the search field. The required
information will appear under the Errata section.

Piracy
Piracy of copyrighted material on the Internet is an ongoing problem across all
media. At Packt, we take the protection of our copyright and licenses very seriously.
If you come across any illegal copies of our works in any form on the Internet, please
provide us with the location address or website name immediately so that we can
pursue a remedy.

Please contact us at copyright@packtpub.com with a link to the suspected


pirated material.

We appreciate your help in protecting our authors and our ability to bring you
valuable content.

Questions
If you have a problem with any aspect of this book, you can contact us at
questions@packtpub.com, and we will do our best to address the problem.

[ xii ]
Asynchronous Programming
in Android
Asynchronous programming has become an important topic of discussion in the past
few years, especially when using the concurrent processing capabilities available on
the most recent mobile hardware.

In recent years, the number of independent processing units (cores) available on


the CPU have increased, so to benefit from this new processing power, a new
programming model called asynchronous programming has appeared to orchestrate
the work between the several independent hardware-processing units available on
the device. Asynchronous programming comes to the rescue to solve the problems
that could arise from this new processing paradigm.

Android applications, since they mostly run on devices with multiple units of
processing, should take advantage of asynchronous programming to scale and
improve the application performance when blocking operations, and when
CPU-intensive tasks are required.

Android is an open source operating system (OS) based on Linux kernel that was
devised in 2003 by Andy Rubin, Nick Sears, Chris White, and Rick Miner, and then
acquired by Google in July, 2005.

The Android OS, actually maintained by Google and the Open Handset Alliance,
was created to provide an open mobile-device platform for devices with limited
resources of computation, memory, and energy.

The platform has been incorporating advanced mobile devices standards, such as
NFC and Bluetooth LE, and its scope has grown from a pure smartphone platform to
a broader software platform for smart watches, TVs, tablets, and consoles.

[1]
Discovering Diverse Content Through
Random Scribd Documents
A Few Typical Cases of Re-orders

Detroit, Mich., Jan. 30, 1919.

Bought twenty I enclose check for 10 lbs. of Hess Pecans.


pounds—orders Could you still take my order for another 10 lbs.? I
75 pounds for wish you to place me on your orders for 75 lbs. of
next season the pecans from next fall’s crop.
W. H.

Sawyerville, Quebec, Mar. 18, 1919.

Will you please take my order for twenty pounds of Hess Pecans from the
next crop? The nuts are just splendid, and we never tasted anything like them
before for flavor.
R. G. B.

Reading, Pa., Jan. 6, 1919.

Had 70 pounds The 70 lbs. Hess Pecans received just before


orders 40 pounds Christmas were eminently satisfactory and
more disappeared like hot cakes. I am enclosing check to
cover the following order: 10 lbs. Ex. Fancy, 20 lbs.
“A,” 10 lbs. “B.”
W. O. L.

Nov. 7, 1919.

Orders 3 barrels Please enter my order for 3 barrels of fancy


later grade pecans.
W. O. L.

Dec. 2, 1919.

The barrel of pecans arrived the day before Thanksgiving. The nuts are gone
and I am ready for more; wish the entire order before the Xmas holidays.
W. O. L.

Buying in 50 lb. F. B., Los Angeles, California (in the heart of the
lots finest walnut district), ordered 22 oz. box for $2,
Feb. 13th, 1917. March 11th, 1917, wrote: “They are
unquestionably the very best I ever ate, and I am wondering if you have more to
offer, and if so, the price in bulk.” Aug. 2, 1917, order booked for Fall, 1917,
delivery, 50 pounds Hess Brand Paper Shell Pecans.
Nov. 27, 1917, sent check for $50 in payment of 50 pounds.
February 26th, 1918, sent his third re-order for 50 lbs. of Hess Brand Paper
Shell Pecans for delivery, Fall, 1918, for $50.
In 1919, purchased 20 lbs., remitting $25.00; 1920, bought orchard units on
our plantations.
16 pounds in less Order received, Dec. 11, 1917, from Dr. M. B.,
than three Wabash, Ind., for $1 box of Hess Brand Paper Shell
months Pecans.
Jan. 8, 1918, “Enclosed find check for $5 for
which ship pecans like the 12 oz. box recently sent me. They are the finest I ever
ate.”
Jan. 24, 1918, sent check for $10 for more nuts.
Feb. 9, 1918, bought orchard units.
“Wish I had a J. C., Seattle, Washington, wrote Jan. 29, 1917:
barrel” “The size, quality, and flavor are all of the very
highest. They are richness itself. Regarding food
value, I question if there is any nut on earth equal to it. I wish I had a barrel of
them. You ought to plant at least 10,000 acres.”
April 10th, 1917, ordered 10 lbs. more for Fall, 1917, delivery, saying, “They
are the very best on earth.”
“The Finest Nuts I Ever Saw”
Says the world famous food authority, Dr. J. H.
Kellogg
Dr. J. H. Kellogg, head of the famous Battle Creek Sanitarium, is
a world famous expert on nuts. His writings, based on a half century
of research, have shown that pecan meat is suitable for “every
month in the year, for all climates, all work and all ages of
mankind (except infants)”, as Good Health stated. He has
directed attention to the fact that pecans give all the food elements
that animal flesh gives, in better proportion and with assured
freedom from impurity and disease. He has made clear the vital
importance of vitamines, found only to a very slight degree in animal
flesh, but profusely found in nuts.
His unquestioned leadership in this field gives added importance
to this letter:
Battle Creek Sanitarium
Battle Creek, Mich., Jan. 18, 1918.
Mr. Elam G. Hess, Pres.,
Keystone Pecan Co.,

Hess Pecans are the finest nuts I ever saw. What a blessing to the world it will
be when these fine products of the vegetable kingdom come to be better
appreciated by the public.
J. H. Kellogg.
From Another Food Authority
New York City, Dec. 27, 1916.

It is not strange that Hess Pecans are so much appreciated; they are so good
to eat. I ate a dozen at my supper and feel that could everyone eat them every
one would be benefited.
Dr. Elmer Lee (Formerly Editor Health Culture).

The Hess Brand Paper Shell Pecan is its own best advocate.
Those who taste it, quickly see why such superior pecans sell readily
at $1.25 per pound, while wild pecans are selling at 35c. per pound.
The only difficulty is that not one person in a thousand has ever
tasted the improved Paper Shell Pecan. Any thinking person,
checking over the records of increasing sales year after year, is sure
to agree with Burbank, America’s foremost horticulturist, when he
says, “We have now one pecan where we ought to have a
million.”
More Evidence of Superiority on Hess Brand
Paper Shell Pecans

Covington, Ky., Jan. 16, 1919.

Over 200 pounds The barrel of Hess Pecans that you sent me got
in a single order here in good condition, weight just as you say—202
lbs.—all right. They are certainly fine nuts and fine
to eat. Nuts and apples make a fine meal, take that from me. Friends of mine
think they are the best nuts (pecans) they ever came across. My advice to the
public—more nuts, less meats and there would be less sickness. I have lived on
nuts, fruit and vegetables for the last four years and never sick.
F. J. L.

Auckland, New Zealand, Mar. 8, 1920.

“Perfect” says Received safely the 12 oz. box of Pecans which


New Zealand you so promptly sent me on receipt of price. The
purchaser pecan is unknown out here, and the arrival of this
stranger caused no little excitement. The pecan is all
you claim for it—we all pronounce it perfect.
F. L. G.

Columbus, Ohio, Nov. 29, 1919.

Food value The box of Hess Pecans arrived O. K., but they
superior to beef didn’t last long. I never saw such a wonderful
product in my life, and as for food value—we need
not worry about Beef becoming short or extinct.
H. J. W., M.D.

Goulburn, Jan. 14, 1918.

They are the first pecans that I have ever seen and I must say that they come
entirely up to your description and are splendid nuts.
C. F. M.

Cleveland, O., Dec. 24, 1919.

“The finest nut I am in possession of the 10 pounds of the


on earth” Paper Shell Pecan. Without doubt it is the finest nut
that exists on earth. I am happy I have bought 5
Units of your wonderful plantation.
M. M.

New Orleans, La., Dec. 30, 1918.

I have received the box of Hess Pecans. I like them so well that I enclose
payment herewith, and request you to send a box to Mrs. G. D., New Orleans.
C. F. L.

South Bend, Ind., Dec. 13, 1919.

Liked 10 lb. box, The 10 lb. Box of Pecans you sent me came to
orders two more hand and are good, fresh, and very fine. I enclose
you my check for $25 for two more 10 lb. boxes.
A. J.

San Jose, Cal., May 3, 1919.

By all odds the I received the box of Paper Shell Pecans, and
best enjoyed them immensely; would say they are by all
odds the best I have ever eaten. I have also eaten
the Creole Pralines of New Orleans, and the nuts used in that confection, although
good, do not compare.
W. S. M., Jr.

Wharton, Tex., Dec. 4, 1919.

Wonderful flavor; I am in receipt of the 10 lb. package of Hess


it is all that you Paper Shell Pecans, and I wish to state that they are
claim the very finest and best flavored that I have ever
tasted. You have produced a wonderful nut and it is
all that you claim.
R. A. G.

Quanah, Texas.

“Finest pecan I ever ate.”


More praise from
Texas
E. S.
The Highest Priced Pecans—Yet Demand far
Exceeds Supply

A few more A high official of the city of New York wrote:


commendations “Such pecans never were seen before in our
from many neighborhood. They are all you advertised them to
received be. I sent a box on to my daughter in Boston.”
Re-orders and From another,
the cash—prove whose husband is at
superiority the head of a
publication which
enjoys national prestige as an exponent of the finest nuts and other foods by mail
order, we received the following letter, along with the second order: “Enclosed find
check for which send package of your Hess Pecans. Kindly ship these at once as
we wish them for Thanksgiving.”
Why take more of your time with detailed copies of letters from
customers ordering and re-ordering Hess Brand Paper Shell Pecans?
Is not the fact that re-orders were received in itself the best
evidence of superior quality when it is considered that the selling
price of many of these shipments was $1.25 for 12 ounces, or at the
rate of $1.65 per pound?
The man whose wife wrote the last letter questioned whether
any one would pay this price—for an addition of fifty per cent. of the
price of the average paper shell pecan was too much, in his opinion.
He questioned the price before he sampled the nuts and noticed
how much they were preferred in his own home and among his
friends. After that the price was forgotten and the recollection of
superior quality led him to re-order, just as it did many others.
Impossible to For the past several years we have had
supply dealers’ to confine our sales almost entirely to mail
demands orders, because the supply has failed to
increase quickly enough to meet the demand. But in 1914 we made
a test in one American city of only 51,000 population (based on the
1910 census) through one wholesale grocery firm. Paper shell
pecans had not been previously known in this section, their
salesmen said that it was absurd to attempt to market a 12–oz. box
of Hess Brand Pecans at the retail price of $1.00, then prevailing. Yet
grocers re-ordered and re-ordered till our available supply was
exhausted—the demand created by the nuts themselves
astonished all concerned.
New York City The city in which this test was made
can consume the was not our home town. It does not stand
world’s supply above the average in per capita wealth—
nor is there any evidence to show that the people of this city are
more likely to be interested in pecans than any average American.
To make such a test in a large city like New York was impossible—for
the entire yield of a 100,000–acre plantation, planted twenty trees to
the acre, could not supply a week’s demand there, if New York
bought pecans in the same proportion as the city cited above.
A leading agricultural publication says:
“Tyler is a Texas town with about 12,000 people who eat a carload of pecans
every year. If New York ate pecans at the same rate, it would consume our whole
crop.” (“Whole crop” refers to all of America’s crops combined, which is also the
world’s crop.)
Why This Phenomenal Demand for Finer
Pecans

There are many reasons for this remarkable demand for the
finest grade pecans—despite the higher price—which reasons are
briefly indexed on the five following pages.
The superiority of The greatest of these reasons is the
these finer superior quality of these pecans, as shown
pecans by tests on pages 33 and 34—the fact that
they have a greater content of easily digested nut meat, of attractive
appearance and greatest nutritive value, which nut meat is easily
accessible, due to their thin shells.
The movement There is a strong movement the world
toward nut meat over toward nut meat as the “true meat,” in
as the “true which some have joined for religious
meat”
reasons, some for ethical reasons, others
from dietetic or hygienic considerations—and many others because
of increasing knowledge of food values.
The Seventh Day Adventists will refer you to the twenty-ninth
verse of the first chapter of Genesis, which reads:
“And God said, Behold, I have given you every herb bearing seed, which is
upon the face of all the earth, and every tree in the which is the fruit of a tree
yielding seed; to you it shall be for meat.” They reason that according to this
passage “true meat” grows on trees, and in this belief they are joined by many
others for ethical, dietetic and hygienic reasons.
By religious, Everywhere in America there are large
ethical and numbers of people, organized and
hygienic
unorganized, who will not eat the flesh of
organizations
any animal. In sanitaria of all sorts there is
a tendency to reduce to the minimum the use
of all animal meat or do away with it entirely.
In one system of forty sanitaria there are
practically no drugs used because the patients
are put on a perfected diet system in which
nuts are substituted for animal flesh. At Battle
Creek Sanitarium alone, under Dr. Kellogg,
over 10,000 patients have adopted the
meatless diet. Nut meat is largely used there
to replace animal flesh.

A 3½ YEAR OLD TREE


on our plantation,
photographed August,
1920. October it bore
many clusters of large,
fully developed pecan
nuts.
Nuts Meet the Demand For Uncooked Foods

The most perfect Many physicians who specialize in


uncooked food diseases of the intestinal tract are advising
the use of uncooked foods. Dr. Kellogg, in his book, Colon Hygiene,
sums up one strong argument in simple, non-technical language
when he says on page 223: “Raw food resists the destructive
changes which are produced by bacteria, while cooked food
makes no such resistance.”
Nut meat is practically the only source of both protein and fat,
in large proportions, which it is safe to eat uncooked. This statement
is readily proved by high authority.
In the Congressional Record for January 6, 1917, we read: “Nuts
occupy a unique position in the list of important food products, in
that, with the possible exception of a few other fruits, in the raw
condition they alone afford a fairly complete and balanced
food for human beings.”
The fact that nut importations in 1917 were nearly ten times as
great in value as those in 1900—while the consumption of animal
flesh had failed to even keep pace with the increase in population—
is evidence of increasing public recognition of the great and varied
advantages of nut meat over animal flesh.
Less butter-fat Possibly you will find this increase in
demanded, more the consumption of nut meats even more
nut-fat surprising when you consider that there
was practically twenty per cent. less butter sold from America’s
farms in 1909 than in 1899, according to U. S. census figures. In
other words, the consumption of butter, which is the principal table
article competing with nuts in fatty content, was falling off to four-
fifths during practically the same period while the consumption of
nut meat was increasing so rapidly.
Perfected pecan nuts contain more protein than beefsteak, and
almost as much fat as butter. Isn’t it only natural that people should
want their nourishment and fat in this concentrated form—
hermetically sealed and kept pure by nature? Is there any such
assurance of purity and cleanliness on butter—or on beefsteak?
Place a Hess Brand Paper Shell Pecan on a hat-pin, light
the nut meat and notice that it burns like a candle because
it is seventy per cent. fat.
“At this age (eight to ten years) the best parts of the orchards under the most
favorable conditions and in favorable years will not infrequently produce from
twelve to fifteen pounds per tree. The average number of trees per acre of the
orchards already planted is twenty. Twenty trees per acre, each averaging twelve
pounds, yield two hundred and forty pounds per acre.” Speech of Congressman
Frank Park, Jan. 6, 1917, as reported in the Congressional Record.
Pecans For Sundaes and Candies, Etc.

The young women of America, who have changed so largely


from soda water and ice cream to nut sundaes, may not realize that
they are getting increased nourishment—but that is the case. That
this is no small element in the consumption of pecans is evidenced
by the fact that one druggist alone uses 1,500 pounds of crushed
pecan meat per year for nut sundaes—while hundreds might
probably use as many if the true figures were known.
The pecan is the Nut candies are
concentrated in such great
form of demand that the best
nourishment.
confectioners are
astonished. But not all nuts are fit for use in
summer. The confectioner who is anxious to
produce a quality product, places his Enos H. Hess, Second
dependence upon the pecan—the finest of Vice President, and
nuts—which nature has furnished in an air- some stockholders of
tight shell, which assures satisfaction the year the Keystone Pecan
round. The confectioners of New Orleans—a Plantation.
hot weather city—long since learned their
lesson and that city is almost as much noted for its pralines—a
pecan nut confection—as for its wonderful fete, the Mardi Gras.
Pralines were too good to be confined to New Orleans alone.
Along the boardwalk at Atlantic City and other watering places, and
at the finer confectionery shops of the larger cities, they are in good
demand. There is no other way to make acceptable pralines except
by using pecan nuts—the finest pralines require that the nuts be
whole, which, in turn, indicates another need for paper shell pecans.
“A Greater Future Than Any Nut Raised In This
Country”
“It is not many years since these delicious nuts, the Paper Shell Pecans, were
first introduced to the people of the North, and wherever they have gone they
have met with instant and cordial favor. The Paper Shell Pecan has a greater
future than any other nut raised in this country. It is a most delicious nut.” Geo. K.
Holmes, noted authority on agriculture, Washington, D. C.
Maximum Food Values In Condensed Form

Greater One remarkable fact about the


digestibility improved paper shell pecan is that it is at
the same time richer in protein and fat than other nuts, yet is more
digestible. People who say, “I cannot eat nuts because I suffer from
indigestion,” are surprised to hear of pecans being prescribed by
physicians—until they try the Paper Shell Pecan themselves and find
that it agrees even with the invalid. Unlike other nuts which contain
less fat—it can be eaten in quantity without salt without any ill
effect. This is probably due to the fact that the improved pecan
contains an oil which seems to possess many of the lubricating and
healing qualities which are found in olive oil.
Convenient, The digestibility of pecan fat is an
condensed established fact—pecans are used largely at
nutriment such scientifically conducted sanitaria as
those at Battle Creek as a substitute for meat and corrective diet in
troublesome cases of intestinal derangement.
Consider the many fortunes made in olive oil—then remember
that even if scientific research should show that pecan oil is not so
beneficial as olive oil, the pecan has many manifest advantages in its
more appetizing form, assurance of cleanliness and purity, etc.,
which makes its future promising.
No authority has ever questioned the nutritive value of the
pecan. Even the wild pecan, which is far inferior in nutritive qualities
to the Paper Shell Pecan, has received high recommendation from
eminent authorities. But the fact that this nutriment was locked up
within a hard shell, separated by a partition so strong and bitter that
it was seldom possible to get out a satisfactory kernel, kept the wild
pecan from enjoying the wide popularity it deserved. The
introduction of the improved seedling and paper shell varieties not
only led to an interest in these improved varieties, but caused such
an increased demand for all pecans that prices rose on even the
poorest wild pecans. But the public found that the best pecans
are the cheapest in the end—and the demand for pecans has
increased most rapidly on these grades from which the
largest kernels, containing the utmost in nutritive value,
could most easily be removed whole.
From one of the largest nut-tree nurserymen
in the world:
“The demand for pecans of all descriptions is increasing faster than the
supply.... The large pecans that we raise bring from 50 cents per pound up to
$1.25. We do not think that the price will ever drop a great deal, though a great
income can be had even at 25 cents per pound or even lower if trees are ten or
more years of age. If one had $1,000 to invest he would be satisfied with 7%,
which is $70, yet five or six trees will bring in this income. There are no diseases
or insects that are bad on the pecan, nothing like as bad as with the apple, peach,
etc., nothing that is anywhere near ruinous. Pecan trees are naturally a wild tree
and therefore very hardy.”
A Test Which Proves The Best Pecans
Cheapest In The End

A comparison of A comparison was made of equal


equal weights of weights of the following grades of pecans:
five grades
First, Common wild pecans selling at
about 25c per pound.
Second, Common seedling selling at about 30c per pound.
Third, Selected seedling selling at an average price of 40c per
pound.
Fourth, Average Paper Shell Pecans, retailing at an average
price of about 75c per pound.
Fifth, Hess Brand Paper Shell Pecans selling at $1.25 per
pound.
This comparison—on the five points (A-B-C-D-E) detailed below
on this page and on the following page—shows which gives you the
most for your money.
Tested on five A—Before Cracking.—Though size of
counts the nut whole counts for but little in judging
pecans, as compared to the quantity and quality of the meat within
the shell, those making the test were interested to note that even in
the case of the few paper shell pecans in Class Four which seemed
larger than an average Hess Brand Paper Shell Pecan, these larger
shells were later found to be only partially filled with meat, or with
many kernels shrivelled.
B—Opening Process.—The Hess Brand Paper Shell was found
to open more readily in the hand without nut crackers, than did the
other classes of nuts when nut crackers were used. When the
fragments of shell were compared it was easy to see why—superior
thinness of shell distinguishes Hess Brand Paper Shell Pecans.
The meat in the Hess Brand Paper Shell Pecans filled the shells
completely, while large air spaces were noted in many varieties in
Class Four.
C—Separating Meat From Shell.—When various lots of nuts
were carefully opened, in separate piles, a careful comparison was
made of the meat and shells in each pile.
“Nature has prepared the soft shell pecan for man’s food by making the kernel
easier both to extract and to digest,” says a well known pecan specialist.
The number of whole kernels was counted—no other pecan had
four-fifths as many whole kernels as were found among the Hess
Brand Paper Shell Pecans. The common wild pecan and the common
seedling had such hard shells that the meat was practically all
broken to small fragments in opening the shells. No detailed
comparison was necessary between these crumbs of nut meat,
mixed with shell and pith, and the whole kernels or half kernels of
the Hess Brand Paper Shell Pecans.
D—The Pith Test.—In the Hess Brand Paper Shell and in the
Paper Shell Pecans of the Fourth Class there was practically no pith—
the inner partition taking the form of a thin membrane
which was easily removed, instead of the thick, bitter wall
of the two cheaper classes of pecans.
The most meat E—The Final Test.—When the nut
per dollar from meat, which was in appetizing or edible
the highest form, was separated from the shells and
priced nuts
partitions in each case, it was found that for
table use the Hess Brand Paper Shell gave the greatest
weight of nut meat for every dollar invested in the nuts,
carriage and opening costs included. The average paper shell
variety which costs nearly as much as the Hess Brand Paper Shell
was a poor second, followed closely by the Third Class (the selected
seedlings), while the two cheap grades were in the end the most
costly investment—because they yielded so small a quantity of
satisfactory nut meat for each dollar invested.
This is also confirmed by many other tests, which show that
even including small particles of nut meat, which are far from
appetizing in form, the wild pecan and the common seedling yield
less than four pounds of meat to each ten pounds of nuts; the
Selected Seedling Pecan and the common Paper Shell about five
pounds of meat to each ten pounds of nuts; and the Hess Brand
Paper Shell Pecan about six and three-quarters pounds of meat to
each ten pounds of nuts.
With such superiority proven for Hess Brand Paper Shell Pecans,
it is no longer a question whether the public will pay the higher
price. It is paying it.
Oskaloosa, Ia., Jan. 8, 1920.

The nuts certainly are life size and look good enough to eat. Every one who
was so fortunate as to get some of the nuts, and they were quite a few,
pronounced them the finest ever. Here is wishing all good things for the pecan
company.
R. S.
More Pecan Orchards—A Vital Necessity

Our only problem NOW is to meet the demand for the highest
grade Paper Shell Pecans.
America demands more fine pecans—it is hungry for them.
“Once a pecan Not only because of the superior food
eater, always a value of pecans; nor only because of their
pecan eater” many advantages as the purest, most
condensed of all natural food products, but also because of their
alluring flavor. As Prof. Hutt, Ex-President of the American
Pomological Society, well puts it, “Once a pecan eater, always a
pecan eater.”
Wherever the improved pecan goes—the world over—it creates
its own market.
It is simply marvelous how hungry the world is for these fine
pecans, and it will be hungry for many years to come because the
increase in supply does not keep pace with the rapidly increasing
demand for high quality pecans. The obvious remedy, therefore, is to
produce more fine pecans by planting more pecan orchards.
Small branches showing
how pecan nuts grow.
How Pecan Trees Do Grow

on our plantations in South Georgia once their wonderful root


system is established.
Above—C. L. Above—A picture to
Cudebec, of Denver, same scale, of same
Col., and Fred. W. tree, one year later.
Burger, of Boulder, The growth in one
Col., (right) at a tree year is shown by
planted in 1919 on portion of tree above
one of Mr. Burger’s hand of boy (Maurice
units. Photo six Forman, of Nogales,
months after Arizona).
planting.

Pecan trees on our plantations—3½ years old.


Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookfinal.com

You might also like