Submit your application to Google Play

Prepare your app

In your “AndroidManfiest.xml” file, set the values for the version name and the version code for your app.

<manifest xmlns:android=""
    android:versionName="1.0" >

The next step is signing your app. If your are using Eclipse IDE, click on your project and export it. Select the “Export Android Application” option in the export window.

Export app

Select the project to export and create a new keystore.

Create keystore

Click Next and create a new key.

Create key

Select your output file and click “Finish”. An .apk file will be generated.

Remember to save your keystore and your passwords to use them in your future updates to Google Play.

Upload your app to Google Play

Open your Google Play Developer Console and click the option “Add new application”.

Add new application

Enter your application name and then you can start by uploading the apk or by preparing the store listing. This process is very simple and you just have to follow the steps.

Upload APK

The application details can be modified after publishing your app. Some of the details to be filled are:

  • Title. Title that will be visible in Google Play.
  • Description. Text description of your application.
  • Screenshots. JPG or PNG images of your application.
  • Icon. A PNG icon in high resolution (512×512).
  • Category and Content rating.
  • Developer data. Website or email address.

After saving your application and submitting it, it will take just some hours to be visible in Google Play.
The application URL in Google Play will be:

where “com.belencruz” is the value of your application package.

Read More

Load a POST request into an UIWebView in iOS

To load a POST request into an UIWebView we use the method “loadRequest” of the UIWebView class. The key is creating the POST request.

To create a POST request you need to create the content body and append it to the request, so use the NSMutableURLRequest class instead of the NSURLRequest class that is usually used to create GET requests. In the request header, add POST as the selected Http method.

// POST data
NSString *content = [NSString stringWithFormat:
   @"param1=%@&param2=%@", value1, value2];

NSMutableData *body = [NSMutableData data];
[body appendData:
   [content dataUsingEncoding:NSUTF8StringEncoding]];

// Create request
NSMutableURLRequest *request = [[NSMutableURLRequest new] autorelease];
[request setURL:[NSURL URLWithString: 

// Headers
[request setHTTPMethod:@"POST"];
NSString *postLength = [NSString stringWithFormat:@"%d", [body length]];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];

// Append body
[request setHTTPBody:body];

// Load into UIWebView
[webView loadRequest:request];

Read More

Activity as Broadcast receiver

In this post I show how to instantiate a broadcast receiver in an activity.
An example for which this kind of broadcast receiver is useful is when calling the GCM library service to register/unregister from the GCM servers.

When the service asynchronously receives the response from GCM servers, if the activity where users configure the notifications is running in the foreground, it is necessary to update its view. The view shows the user if notifications were successful activated or not.

  • Create the broadcast receiver in the activity class.
    private BroadcastReceiver gcmReceiver = 
    new BroadcastReceiver() { 
      public void onReceive(Context context, Intent intent) {
        // Update view
  • Call register and unregister methods in the activity class.
    public void onResume() {
                       new IntentFilter("com.belencruz.GCMResult"));  
    public void onPause() {
  • Broadcast from the service.
    public class GCMIntentService extends GCMBaseIntentService {
      protected void onRegistered(Context context, String regId) {
        // ...
        Intent bcIntent = new Intent();
        bcIntent.putExtra("com.belencruz.code", GCMState.ACTIVE);
      protected void onUnregistered(Context context, String regId) {
        // ...
        Intent bcIntent = new Intent();
        bcIntent.putExtra("com.belencruz.code", GCMState.INACTIVE);
      protected void onError(Context context, String errorId) {
        // ...
        Intent bcIntent = new Intent();
        bcIntent.putExtra("com.belencruz.code", GCMState.ERROR);

    Read More