Pages

Tuesday 15 May 2012

To do list for publishing your Android application on Google play app store


Let us go through the steps to be followed for publishing an android application.

  • Confirm that your application is free from errors. If possible avoid warning also to make your code clean and beautiful.
  •   Test your apk with emulator, do this for many times, so that you can find out small mistakes. 
  •  As a final test copy your apk to any device that support you application's android target version,there you can install it and see how it works.
I recommend this because you may have used some local resources like the local network of your computer system(with or without proxy settings) or local domain names,etc.. So do a final check to confirm everything is accessible from the device. ]

If all these works fine, then you can start preparation for publishing your great application.
    
  • You need a gmail account to open a google play developer account . If you have one, use it. Otherwise sign up for  new account here 
https://accounts.google.com/SignUp?service=mail&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&ltmpl=default&hl=en

  • Now you can open a new Google play developer account here. 
https://accounts.google.com/ServiceLogin?service=androiddeveloper&passive=true&nui=1&continue=https://play.google.com/apps/publish&followup=https://play.google.com/apps/publish .

Now you are in Google play console. There is simple registration process to complete. Go with that. You have to pay a one time registration fee $25, then you can publish your apps anytime you want. For the completion of registration process and verification of your payment details,it will take 24-72 hours, so pls avoid mistakes because it will waste your another 2-3 days. 

[Do not forget to check your account status regularly by login to the developer console. ]

You don't have to waste your precious time on these long hours. You can start preparation for publishing now itself. Because you can upload you apk that is ready to publish here and you can create resources needed for your application and can also edit the app details. But you can publish it only after completing the registration.

 If there is any problem with your registration after uploading the apk,don't be panic..the google play help team is there to support you. You can mail them directly to ask your doubts. they will help you until you get satisfied.

For you doubts in apk publishing and updation contact email id:
googleplay-developer-support@google.com

If you have any problems in registration process contact :
wallet-support@google.com

Now we can start

  • Get the public key of you google play account . Go to "Edit profile" link in the google play android developer console home page. There you can find your public key under "Licensing & In-app Billing" section. You need this value for licencing your app.
 [ You are not forced to do the licensing for your app. But it is a recommended way of publishing, to make your apk safe. The alternate facility available is to do the copy protection which will be removed soon.So it is better to use for both paid and free apps]





 Steps for licencing your app
  • Now you need  License Verification Library (LVL). First you check whether they are already with your android installation. For that go to android sdk folder(installed Android folder),  open extras->google->market_licensing->library.
  • Copy the contents of src folder inside the library folder to your application src folder  
           [ com.android.vending.licensing and com.android.vending.licensing.util ].


  • Adding License to your application
  Now see the sample folder inside the market_licensing folder. There you can find a sample licensing activity which you are going to add to your application


package com.example.android.market.licensing;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.provider.Settings.Secure;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.TextView;

import com.android.vending.licensing.AESObfuscator;
import com.android.vending.licensing.LicenseChecker;
import com.android.vending.licensing.LicenseCheckerCallback;
import com.android.vending.licensing.ServerManagedPolicy;

/**
 * Welcome to the world of Android Market licensing. We're so glad to have you
 * onboard!
 *

 * The first thing you need to do is get your hands on your public key.
 * Update the BASE64_PUBLIC_KEY constant below with your encoded public key,
 * which you can find on the
 * Edit Profile
 * page of the Market publisher site.
 *

 * Log in with the same account on your Cupcake (1.5) or higher phone or
 * your FroYo (2.2) emulator with the Google add-ons installed. Change the
 * test response on the Edit Profile page, press Save, and see how this
 * application responds when you check your license.
 *

 * After you get this sample running, peruse the
 *
 * licensing documentation.

 */
public class MainActivity extends Activity {
    private static final String BASE64_PUBLIC_KEY = "REPLACE THIS WITH YOUR PUBLIC KEY";

    // Generate your own 20 random bytes, and put them here.
    private static final byte[] SALT = new byte[] {
        -46, 65, 30, -128, -103, -57, 74, -64, 51, 88, -95, -45, 77, -117, -36, -113, -11, 32, -64,
        89
    };

    private TextView mStatusText;
    private Button mCheckLicenseButton;

    private LicenseCheckerCallback mLicenseCheckerCallback;
    private LicenseChecker mChecker;
    // A handler on the UI thread.
    private Handler mHandler;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
        setContentView(R.layout.main);

        mStatusText = (TextView) findViewById(R.id.status_text);
        mCheckLicenseButton = (Button) findViewById(R.id.check_license_button);
        mCheckLicenseButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                doCheck();
            }
        });

        mHandler = new Handler();

        // Try to use more data here. ANDROID_ID is a single point of attack.
        String deviceId = Secure.getString(getContentResolver(), Secure.ANDROID_ID);

        // Library calls this when it's done.
        mLicenseCheckerCallback = new MyLicenseCheckerCallback();
        // Construct the LicenseChecker with a policy.
        mChecker = new LicenseChecker(
            this, new ServerManagedPolicy(this,
                new AESObfuscator(SALT, getPackageName(), deviceId)),
            BASE64_PUBLIC_KEY);
        doCheck();
    }

    protected Dialog onCreateDialog(int id) {
        // We have only one dialog.
        return new AlertDialog.Builder(this)
            .setTitle(R.string.unlicensed_dialog_title)
            .setMessage(R.string.unlicensed_dialog_body)
            .setPositiveButton(R.string.buy_button, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(
                        "http://market.android.com/details?id=" + getPackageName()));
                    startActivity(marketIntent);
                }
            })
            .setNegativeButton(R.string.quit_button, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    finish();
                }
            })
            .create();
    }

    private void doCheck() {
        mCheckLicenseButton.setEnabled(false);
        setProgressBarIndeterminateVisibility(true);
        mStatusText.setText(R.string.checking_license);
        mChecker.checkAccess(mLicenseCheckerCallback);
    }

    private void displayResult(final String result) {
        mHandler.post(new Runnable() {
            public void run() {
                mStatusText.setText(result);
                setProgressBarIndeterminateVisibility(false);
                mCheckLicenseButton.setEnabled(true);
            }
        });
    }

    private class MyLicenseCheckerCallback implements LicenseCheckerCallback {
        public void allow() {
            if (isFinishing()) {
                // Don't update UI if Activity is finishing.
                return;
            }
            // Should allow user access.
            displayResult(getString(R.string.allow));
        }

        public void dontAllow() {
            if (isFinishing()) {
                // Don't update UI if Activity is finishing.
                return;
            }
            displayResult(getString(R.string.dont_allow));
            // Should not allow access. In most cases, the app should assume
            // the user has access unless it encounters this. If it does,
            // the app should inform the user of their unlicensed ways
            // and then either shut down the app or limit the user to a
            // restricted set of features.
            // In this example, we show a dialog that takes the user to Market.
            showDialog(0);
        }

        public void applicationError(ApplicationErrorCode errorCode) {
            if (isFinishing()) {
                // Don't update UI if Activity is finishing.
                return;
            }
            // This is a polite way of saying the developer made a mistake
            // while setting up or calling the license checker library.
            // Please examine the error code and fix the error.
            String result = String.format(getString(R.string.application_error), errorCode);
            displayResult(result);
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mChecker.onDestroy();
    }

}


Edit your main activity with this sample. Enough comments are there to help you. 

Replace public key with yours, and enough comments are there to edit. Copy the methods except the onCreate() and copy the code inside the onCreate() to your onCreate() method. Thats all.

You cannot test your code in this time, since it is checking the licensing,you cannot access the functionalities with emulator, you will be getting a message saying that you need licence.

  • Next you need to get a debug key that is valid for minimum 50years
        For that first you need to create a keystore. Open terminal(in linux) or command prompt(in widows).
Run the following command:
  keytool -genkey -v -keystore keystorefilename.keystore -alias aliasforkeystore 
  Provide the details after specifying a password for the keystore.Then a keystore file in the name keystorefilename.keystore will be created on the current path.
  •   Now open Eclipse,->  Select you application. Select File->export->export android application(sub option under Android). Next->browse project->Next->select use existing keystore file->browse keystore file and enter password(you just created)->Next->select create new key->Enter the details(Remember to give validity field greater than 50years)->next->finish.
Now your apk is ready to upload. Check you have entered a version code and version name which should be changed on each updation.

Now go to Google play. Upload you apk there. Edit the product details. You can add graphic assets,video link(demo for your app) etc.

If your registration process was completed, publish your app and test the licensing procedure. It will work fine, if you have done everything clean. If it has any problem, don't get upset. Edit your application based on the error showing. Change the version code and version name -> clean & compile your app -> repeat process for the debug key->  get your apk-> upload it as a new apk on google play. Deactivate older apk and activate your new apk and save.

You can change the product details any time you want. Just save the details and wait for a while, you will get your update on market page.

There is an option to add expansion files when your apk is of more than 50MB.

Now everything done..


Go ahead with your Android journey..Best of luck.. :)





12 comments:

  1. Very helpful Article

    Thanks

    ReplyDelete
  2. Hello Sir........
    I am new in mobile Apps Development
    i ma student. I develop my app in sencha Touch Framework..
    and i want to publish in google app store...
    is their way to publish app without paying money....

    ReplyDelete
    Replies
    1. I Am not familiar with Sencha Touch Framework.Hope this will help
      http://docs.sencha.com/touch/2-0/#!/guide/native_android

      Delete
  3. can you please suggest me to publish my app http://www.richtown.ae/?q=content/contact-us other than google play

    thanks.

    ReplyDelete
  4. hi i have an app. i want to publish that app in playstore.i have checked this app several times and confirmed that it is error free.This app(free) is not for everyone but only for my clients.The reason behind uploading to playstore is that everytime i dnt want to send e-mail to everyone,just upload it in playstore so that they can download it from there.So please tell me what are the formalities for uploading a app in google playstore as i am new to this platform

    ReplyDelete
  5. hi,

    I am new to android development and am trying to build an ecommerce app. Could you please tell me how I should update the app's product listings or do I need to buy hosting for the database to update the app from there via an admin panel.

    ReplyDelete
  6. Google Play Store Registration need credit card and many people have no valid payment method I offer a free solution for all
    I offer 2 services
    If you have website I will convert into Android Mobile App.
    If You have App and Want to publish Free on Play Store I Will Publish your App On Google Play Store
    If You want to develop Responsive Website I will do all these things in very friendly cost as you like.
    Visit us
    IT Zem Solutions
    www.itzem.com/android-ios-apps-development-and-publisher/

    Contact Skype: Rohibook
    Whatsapp: +923008608035

    ReplyDelete
  7. Is there checklist from android to make sure the quality of app.

    ReplyDelete
  8. I need some help figuring out resolution for mobile app design?
    church app design

    ReplyDelete
  9. great post Vendorzapp provides Mobile apps for small business, Ecommerce android apps India, iOS ecommerce apps, Ecommerce website Pune, Ready ecommerce website and apps. Android ecommerce apps then visit now Ecommerce android apps India, iOS ecommerce apps, ecommerce website for small business call us +91-9850889625

    ReplyDelete