Hello Mobile Payments (Again)

As part of the Apple keynote, Apple announced Apple Pay.  It allows iOS users (iPhone 6+  or an Apple Watch is required) to pay for their goods at the store using their devices.  At check out, instead of digging out your credit / debit card, you tap your phone (or watch) and authenticate.  A short lived, unique token is transferred using NFC (Near Field Communication) to the point of sale device.

This concept is now new.  Most Android users have had this ability for sometime now using, Google Wallet and NFC.  I have tapped to pay for purchases at Walgreens and Sheetz over the last few years (and the cashier always looks at me as if I am hacking their register).  Google Wallet leverages MasterCard’s PayPass technology for contact-less payments.  When you pay using Google Wallet (via tap and pay), Google sends the merchant the credentials for a virtual MasterCard.  Google then deducts the funds from the credit / debit card you chose to pay with.  This is great because it offers a level of abstraction between your actual credit / debit cards and the merchant’s payment processing system (assuming Google Wallet isn’t compromised).  I assume that your virtual MasterCard never changes.  Looking at my previous Tap and Pay transactions, the last digits of the virtual MasterCard used has remained the same.  Technically, this virtual MasterCard can be compromised (ie. Target style payment system hack).  This is essentially a workaround for Google Wallet.  Instead of partnering with all major credit card companies for contact-less payments, they only needed to partner with one, MasterCard.

Apple Pay Payment Flow, Source: Apple.com

There is an important and key difference between Google Wallet and Apple Pay.   Apple Pay works natively with your credit / debit cards (supports Visa – Visa Token Service, MasterCard – MasterCard PayPass, and American Express).  First, when you add your credit / debit cards to Apple Pay, the credentials are encrypted and stored in the security enclave of your iPhone 6 and never leave the device (Google Wallet, the secure element is moved to the cloud, so this is where your credit / debit card information live).  Secondly, when you tap and pay your iPhone 6 (or Apple Watch) on a supported point of sale system, a short lived, unique token is transmitted to the merchant via NFC.  A few moments later, your purchase is completed.  As far as I know, this does not involve a virtual card middle man, further increasing the security.  If the merchant has their payment systems compromised, your are protected because your permanent credit / debit card credentials remain encrypted on your iPhone.

There were other, recent innovations in the payments space.  Specifically, as a backer of Coin, I feel the window to do what they are specifically doing is rapidly closing.  Coin essentially allows you to access your credit / debit cards using a bluetooth connected device (paired with your phone).  Instead of carrying a wallet containing multiple cards, you carry one with access to your cards (stored in the Coin App on your device).  Google Wallet and Apple Pay are rapidly obsoleting the need to even carry a wallet at all (and Coin).

The road to modernizing our payment systems has been a long one.  Modernization is starting to turn into a necessity as more and more merchants have their payment systems compromised (Target, PF Chang’s/Pei Wei, Home Depot to name a few).  I’ve been pretty eager to move to an electronic wallet system so I can carry (and lose) one less thing (a wallet).  It’s uptake has been pretty glacial so far, however, Apple’s entry into this space will build momentum for mobile payments because Apple (iOS) users are some of the most enthusiastic users and merchants would do well to support Apple Pay (and by association, Google Wallet).

DatePickerDialog on Android


The DatePickerDialog (and TimePickerDialog) APIs on Android are great and provide great functionality out of the box.  However, there is this bug in the Android framework that will prevent your Android apps, that use this API, from being great.

Issue 34833 – Android 4.1 DatePickerDialog Malfunction – Reported on July 12, 2012

Long story short, pressing the ‘Done’ button on a DatePickerDialog calls the a function twice, no bueno.

There is a pretty easy work around that allows you use the DatePicker while avoiding this issue.  Hopefully Google fixes this in Android L.  Now for some real code (belongs to a project I’m currently working on).

Let’s start out with a layout file, dialog_date_picker.xml.  This is the layout of my dialog.

<?xml version="1.0" encoding="utf-8"?>
<DatePicker xmlns:android="http://schemas.android.com/apk/res/android"

Let’s configure the Dialog portion of our DatePickerDialog.  I chose to go with a DialogFragment.

public class DatePickerFragment extends DialogFragment {

private OnDateChosenListener mListener;

public class DatePickerFragment extends DialogFragment {

    private OnDateChosenListener mListener;

    public Dialog onCreateDialog(Bundle savedInstanceState) {
        final DatePicker datePicker = (DatePicker) getActivity().getLayoutInflater().
                inflate(R.layout.dialog_date_picker, null);
        //Set an initial date for the picker
        Calendar c = Calendar.getInstance();
        int year = c.get(Calendar.YEAR);
        int month = c.get(Calendar.MONTH);
        int day = c.get(Calendar.DAY_OF_MONTH);
        //Set the date now
        datePicker.updateDate(year, month, day);

        //create the dialog
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        //set the title
                .setPositiveButton(R.string.picker_confirmation, new DialogInterface.OnClickListener() {

                    public void onClick(DialogInterface dialog, int which) {
                        // do some stuff with the date
        return builder.create();

Looks like pretty standard dialog code. Pay special attention to the function call setPositiveBuilder on our AlertDialog builder. Here we define a ‘Done’ button, but this time the DatePickerDialog doesn’t get called again when pressing it.

Finally, let’s call show our dialog.

// from an Activity...
DatePickerFragment dialog = new DatePickerFragment();
dialog.show(getFragmentManager(), "datePicker");

Of course, you could avoid all of this and use a more beautiful date and time picker, FlauvienLaurent DatetimePicker (GitHub)

Diversity of Various Tech Companies

Came across a great article that provides additional context on diversity in tech.

Diversity of Various Tech Companies By the Numbers

With Apple’s report today (finally), major tech companies have all published information about racial and gender diversity. I thought it might be useful to run the numbers and compare them against the demographics of the United States as a whole, for reference. All data is as-reported from each company.

Source: Pixel Envy