Blog | jessechen.net

Post-hoc Analysis of InstaWifi’s Launch

July 27, 2012 9:00 am by
high resolution instawifi icon

Launching My First Android App Ever

On July 24th, I launched InstaWifi, my first Android app into the market. InstaWifi enables you to connect and share wifi networks instantly with the people who you care about. It was my first Android app that I released in the market, and I was pretty excited to see how it would turn out. It’s quite amazing if you think about it, that a random guy (like me) behind a computer screen today in 2012, can reach out to an audience of thousands of people on the Internet to announce a new product. It’s a random thought but a powerful one — a thought that reminds us of how closely connected we are to other people in this world.

My marketing strategy was simple for InstaWifi, generate viral growth on social networks, and reach out to several news sources online to get some big pageviews so that it will trickle down to smaller blogs, news sources, and social networks. The best strategy, however, is to just make a solid polished app and one that actually solves a problem for users. Without a good implementation, it doesn’t matter how big your budget or effective your marketing strategy is.

This article will be doing a deep dive on the numbers and stats of InstaWifi’s launch for those people out there who are curious on what it’s like to launch an Android app and how successful InstaWifi was.

(more…)

About

Jesse is a software engineer at Facebook, who just graduated from UC Berkeley. Passionate about mobile technology and entrepreneurship, he started his own blog as a home for his tutorials, projects, and random thoughts. Follow him on Facebook to stay updated on his latest tutorials and projects.


Playing the Student Card

March 8, 2012 9:48 pm by
student card

Introduction

One memorable quote I remember from being in Ken Singer’s Mobile Entrepreneurship class is him telling us to always “play the student card”. People enjoy helping students because of a combination of a) its less pressure for them since we don’t work yet (not trying to use them to get a job, or for any other obvious personal gains) and b) they want to help younger folks because they once were in the same situation before as a student. For companies, they want to help us because they want to invest in their brand loyalty toward younger audiences, so that once we have a job and money, we are aware of their company and will continue to use their products.

Turning in my student card

As my years of being a student comes to an end, its time to take a look back and acknowledge the different people and companies that helped me get to where I am now.

  • GitHub
    • As a student studying CS, having a Micros plan on GitHub is invaluable.  A free Micros plan allows you to have up to 5 private repositories with unlimited collaborators.  A must-have for your CS projects and hackathons.
  • Adobe Creative Suite 5
    • Starting in August 2011, all UC Berkeley students gets a free copy of Adobe Creative Suite 5.  Normal price is 379$ for a license (which is out of reach for the 99% of students), so this is a great opportunity for people to learn how to use Photoshop, Fireworks, Illustrator and etc. for their class and personal work.
  • Microsoft Software
    • UC Berkeley students get MS Office and MS operating systems like Windows 7 and XP for free.  Students can barely afford food to eat, who in their right mind would cough up 100$ for a Windows 7 license?  This is a strategic move by Microsoft to ensure that we continue to use their products rather than their competitors.
  • Amazon Prime
    • Back in my day (~2010), Amazon had a promotion for students to have 1-year of Amazon Prime for free (free two-day shipping on all eligible products).  Now, it’s only 6 months but it’s still great.  When my trial expired, I was so spoiled by Amazon Prime service that I renewed my service for 40$/year.
  • Google I/O
    • Every year, Google holds a developer conference to bring thousands of developers for a two (this year, three) day event to network, attend talks, and listen in on the newest products coming from Google. This is a great opportunity for students to get a taste of the real world.  When I first attended Google I/O in 2010, it showed me what computer science is outside of academia, and made me so excited to pursue programming.  That led to me going again in 2011 by the skin of my teeth.  They gave me my first smartphone (my current phone at that time was a Motorola Razr, remember those things?), and since then, I have wrote Android apps, tutorials of many sorts, and have brought me into my passion for mobile.

Now these are services or events that are discounted for students.  The next list is a list of competitions I attended where I played the student card to my advantage.  Younger students take note :)

  • Facebook Mobile Hack
    • Facebook’s Mobile Hack is where you learn how to integrate Facebook services into your mobile app.  At the end, there is a hackathon where you compete for prizes.  I find that when introducing ourselves as “students at UC Berkeley studying CS”, we tend to get more attention that way (since everybody else were working adults).  Take it for what it’s worth, but playing the student card when you are the minority seems to give you an edge.  Not to mention, winning this hackathon got me a job offer.
  • AnDevCon III
    • Playing the student card once again, to try to appeal to the contest organizers.  However, notice there are also several other students playing the student card.  I think perhaps why mine stood out some more was the fact that I was more clear on why I feel like I should go.  Winning a 1,245$ ticket for writing a comment?  Not bad!

Conclusion

Take advantage of the fact that you are a student.  You only have this liberty for 4 years in college before you become a working adult.  The companies, people, and events that you meet and go to love the fact that you are an ambitious student and often times are willing to help one way or another!  For me, I will always be grateful for my student card because it

  • got me my job
  • got me into my career/interest, mobile
  • got me into building apps and competing in more hackathons
  • got me into conferences that I would never be able to afford

The student card is only valid for 4 years.  Use it before it expires.

 

Filed under: General — Tags: , , , , , , , , , , , — Jesse Chen @ 9:48 PM

About

Jesse is a software engineer at Facebook, who just graduated from UC Berkeley. Passionate about mobile technology and entrepreneurship, he started his own blog as a home for his tutorials, projects, and random thoughts. Follow him on Facebook to stay updated on his latest tutorials and projects.


How Does Google Plus Instant Upload Work?

August 18, 2011 5:13 pm by
Instant Upload

Introduction

When I first heard about Google Plus and their Instant Upload feature, my initial thought was “how does this work?”.  I did a quick search on Google to see if there were any other people who were curious about how they do it.  I found only one useful result, this stack overflow post (stack overflow has been invaluable this summer), and it got me thinking about how cool it would be to try to do the same thing.  The words ContentProvider and ContentObserver was gibberish to me but I dedicated one night to see if I can figure this thing out.  Turned out, it was actually quite easy and not that hard to understand.

This is probably not the exact way that Google+ used to implement Instant Uploads, but it provides the same functionality, with a bonus that Google+ does not have – that it’ll work with any camera app, not just the native camera app.  My hope is that this tutorial will help others that may be curious about how to do something similar.

Content Providers are the only way to share data across different applications.  They can store and read data, and Android has a bunch of content providers already provided for you for common data types, such as video, audio, images and contacts.

Content Observers are just that.  It’s an abstract class that has a method that gets called when it observes a change in a content provider.

Hopefully you figured out now that what we simply have to do is register a content observer to the images content provider.

InstantUploadActivity

Let’s create a simple and useless Android project that will detect when a picture is taken and display the most recent picture’s file name in a TextView.  The content provider that we want to observe is the one that Android provides for images, and the URI for that is MediaStore.Images.Media.EXTERNAL_CONTENT_URI.

We start with the onCreate method in the Activity:

public class InstantuploadActivity extends Activity {

    private PhotosObserver instUploadObserver = new PhotosObserver();
    private String saved;
    private TextView tv;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        tv = (TextView)findViewById(R.id.textview);

        this.getApplicationContext()
            .getContentResolver()
            .registerContentObserver(
                MediaStore.Images.Media.EXTERNAL_CONTENT_URI, false,
                instUploadObserver);
        Log.d("INSTANT", "registered content observer");
}

Upon creation of this Activity, we register our custom PhotosObserver (which extends ContentObserver) to the images content provider.

Recall that the goal for this project is to simply take the most recent picture’s file name and display it in our Activity’s TextView, tv.  To get alerted when a new picture is taken, we have to create a class that extends ContentObserver and implement the onChange method:

private class PhotosObserver extends ContentObserver {

    public PhotosObserver() {
        super(null);
    }

    @Override
    public void onChange(boolean selfChange) {
        super.onChange(selfChange);
        Media media = readFromMediaStore(getApplicationContext(),
        MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
        saved = "I detected " + media.file.getName();
        Log.d("INSTANT", "detected picture");
    }
}

private Media readFromMediaStore(Context context, Uri uri) {
    Cursor cursor = context.getContentResolver().query(uri, null, null,
        null, "date_added DESC");
    Media media = null;
    if (cursor.moveToNext()) {
        int dataColumn = cursor.getColumnIndexOrThrow(MediaColumns.DATA);
        String filePath = cursor.getString(dataColumn);
        int mimeTypeColumn = cursor
            .getColumnIndexOrThrow(MediaColumns.MIME_TYPE);
        String mimeType = cursor.getString(mimeTypeColumn);
        media = new Media(new File(filePath), mimeType);
    }
    cursor.close();
    return media;
}

private class Media {
    private File file;
    @SuppressWarnings("unused")
    private String type;

    public Media(File file, String type) {
        this.file = file;
        this.type = type;
    }

    public String getType() {
        return type;
    }

    public File getFile() {
        return file;
    }
}

In the onChange method we call readFromMediaStore, which will retrieve data about the most recent picture (the one that was just taken). readFromMediaStore initializes a Cursor on the same Images URI that we’ve been observing.  We then grab the filepath and the filetype from the first result (note: the cursor was sorted by “date_added DESC”) and create a new Media to return.  Keep in mind that this can be done when our Activity is not running in the foreground.  You can launch InstantUploadActivity, press “Home” to back out, then go to Camera and take a picture – and the onChange method will still get called.

From here, we simply set the String variable saved to display the filename such that when you go back to the Activity, the filename of the picture you have just taken is displayed in the TextView via the onResume method:

@Override
public void onResume() {
    super.onResume();
    if (saved != null) {
        tv.setText(saved);
    }
}

Lastly, don’t forget to unregister the content observer if onDestroy is called:

@Override
public void onDestroy() {
    super.onDestroy();
    this.getApplicationContext().getContentResolver()
            .unregisterContentObserver(instUploadObserver);
    Log.d("INSTANT", "unregistered content observer");
}

You can do much better than just setting text on a TextView.  You can take that image and resize it, and then upload it somewhere, or you can automatically apply an image filter on each picture or do both!  There are many cool things you can do with this.

Check out the full source code on github here.

Conclusion

This was my second hackathon project at Facebook, and I was able to implement this functionality into the Android Facebook app successfully such that whenever you took a picture from any camera app, it would get uploaded to your Mobile Uploads album.  Instead of storing the filepath of the most recent picture like in the example above, I grabbed the URI of the picture that was just taken and sent it to an upload service in the Facebook app that took care of uploading the picture to your album.  I also built some preferences so that you can enable or disable it depending on if you’re connected to wifi, roaming, or charging your phone.

Unfortunately, my hackathon project is not going to be implemented but it was a fun learning experience.  It is also hard to describe the utter excitement when seeing this work for the first time at 5am, having a picture taken from your camera and onto Facebook in a matter of seconds.  Stay tuned for another tutorial on another hackathon project!

EDIT: And here it is: How to NFC on Android

Filed under: Android,How to — Tags: , , , , , , , — Jesse Chen @ 5:13 PM

About

Jesse is a software engineer at Facebook, who just graduated from UC Berkeley. Passionate about mobile technology and entrepreneurship, he started his own blog as a home for his tutorials, projects, and random thoughts. Follow him on Facebook to stay updated on his latest tutorials and projects.