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_800
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

Screenshot_2014-09-10-20-35-04~2

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"
    android:id="@+id/date_picker"
    android:layout_width="fill_parent"
    android:spinnersShown="true"
    android:calendarViewShown="false"
    android:layout_height="fill_parent"/>

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;

    @Override
    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
        builder.setTitle(getString(R.string.date_picker_title))
                .setView(datePicker)
                .setPositiveButton(R.string.picker_confirmation, new DialogInterface.OnClickListener() {

                    @Override
                    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

Diversity (Lacking) in Tech

Twitter, following in the same steps of Google, Facebook, Yahoo, and other big technology companies, published statistics regarding the diversity of their workforce.

Screen_Shot_2014-07-23_at_12.23.21_PM_medium
Screen_Shot_2014-07-23_at_12.23.10_PM_medium Gender and Ethnic Breakdown at Twitter

As I would have guessed (and have observed in real life), most tech companies are (disproportionately, relative to the ethnic makeup of the United States) comprised of White males, especially in technical fields.  Across the board (at Google, Twitter, Facebook, and Yahoo), only 1-2% of technical roles are filled by Black workers.  One would think that under ideal circumstances, the workforce makeup would somewhat resemble the ethnic makeup of the United States.  There is obviously a gap somewhere, whether it be societal barriers, education, achievement gaps, cultural issues, racism, access to resources, etc.

I’m curious, for my Black brothers and sisters in tech that I have met (I do know quite a few), how do they differ, what did they do differently, how was their upbringing different that provided them the opportunity to work in technology, what decisions did they make, what barriers were or were not in their way?  For myself, my path to a software engineering career was:

  • Grew up in a relatively stable, middle class family
  • Had a parent who works in Health IT
  • Had a computer (first was an IBM PS/2) at home and was coding in Basic at a young age
  • Had internet access (AOL)
  • Each classroom (schools in NJ, NC, and Hawaii), from what I can remember, had at least one computer and a decent computer lab
  • Enrolled in an engineering program (I didn’t get into NC State Engineering as a freshman, I actually needed to take a few extra classes, then I transferred in) and somehow graduated with a degree in Electrical & Computer Engineering
  • Strong, close Black community at NC State, across majors and in Engineering
  • Interned in tech (often through INROADS, this program has had a significant impact on my career)
  • I have a genuine interest and passion in building things

With all that said, I have brothers and classmates who have had similar experiences growing up, but aren’t in tech all.  There are others who’s experience was different and they are in tech (I’m sure there are some key similarities between their and my experience).  I’m not a sociologist by any means, so I can’t speak to society at large.  I can only hypothesize answers to some of the questions below:

  • Is there a general lack of interest in tech (or STEM at large) in the black community?
  • Are their societal barriers?  If so, why?  Why are some overcome?  Why are some not overcome?
  • Does access to good schools with computers and the internet play a role?
  • How big of a role does a stable household and environment play?
  • How big of a role does exposure to technology play (ie. parents or mentors in STEM, computers at home, etc.)?
  • What role do technology companies have in all of this?

These are all questions (and I’m sure there are more) that I would really be interested in legitimately having an answer for.  I’m excited that this discussion is happening and hope it’s the first step of many in increasing diversity in STEM because all things being equal, I believe a more diverse workforce is a better and more competitive workforce and makes for a healthier society.

Source: Twitter