Wednesday, 23 August 2017

Free Website Kaise Banaye ~ niit post

Free Website Kaise Banaye

Agar aapko online paise kamane me interest hai, ya fir aapko aapki khud ki website banana he to, mai aapko bataunga ki free website kaise banaye. Website banana bohot asaan hai. Aapko lagega sirf ek Google Account, Gmail ID aur usse associated ek Blogger Account. Blogger ye Google ka product hai aur isme hum free me apna khudka blog start kar sakte hai. Aapko apna khudka ek URL milega jisko aap world wide publish kar sakte ho aur har koi aapke website ko publically dekh sakega.  Chaliye jante hai ki Free me Website Kaise Banaye.

Step 1 – Chahiye ek Gmail Account
Hum Gmail ID ko use kar ke website banayenge, Gmail Google ka hi ek product hai, aur hum jipar website banayenge – Blogger ye bhi Google kahi product hai, Blogger par hum free me website bana sakte hai. Sabse Pehle aapko lagega aapka Gmail ID. Agar aapne GMail nahi create kiya hai to pehle Gmail ID bana le.



Read this : Email ID Kaise Banaye
Abhi aap www.blogger.com pe jaye.

Yaha par aaka GMail ID aur Password se login kare.



Blogger Par Sign Up Kare



 Step 2 – Banaiye Blogger Account
Login karne ke bad aapko screen par New Blog button par click kare.


New Blog button par click karne ke bad agle screen par aapko website ka nam aur website ka address dalna hoga.


Website ka Title aur Website ka address dalne ke bad nich Create Blog button par click kare.


 Step 3 – Add Kijiye New Post
Hamne abhi website ki link choose kar li he.

Hamari website abhi thodi hi der me ready ho jayegi.


Agle screen par New post par click kare.

Hume ab hamara Article dalna hai, Agle screen par aapka article likhe.


Free Website Kaise Banaye

Agar aapko online paise kamane me interest hai, ya fir aapko aapki khud ki website banana he to, mai aapko bataunga ki free website kaise banaye. Website banana bohot asaan hai. Aapko lagega sirf ek Google Account, Gmail ID aur usse associated ek Blogger Account. Blogger ye Google ka product hai aur isme hum free me apna khudka blog start kar sakte hai. Aapko apna khudka ek URL milega jisko aap world wide publish kar sakte ho aur har koi aapke website ko publically dekh sakega.  Chaliye jante hai ki Free me Website Kaise Banaye.

Step 1 – Chahiye ek Gmail Account

Hum Gmail ID ko use kar ke website banayenge, Gmail Google ka hi ek product hai, aur hum jipar website banayenge – Blogger ye bhi Google kahi product hai, Blogger par hum free me website bana sakte hai. Sabse Pehle aapko lagega aapka Gmail ID. Agar aapne GMail nahi create kiya hai to pehle Gmail ID bana le.
Abhi aap www.blogger.com pe jaye.
Yaha par aaka GMail ID aur Password se login kare.

Blogger Par Sign Up Kare
Blogger Par Sign Up Kare

 Step 2 – Banaiye Blogger Account

Login karne ke bad aapko screen par New Blog button par click kare.

Free Website Kaise Banaye
Free Website Kaise Banaye

New Blog button par click karne ke bad agle screen par aapko website ka nam aur website ka address dalna hoga.

Create a New Blog
Create a New Blog

Website ka Title aur Website ka address dalne ke bad nich Create Blog button par click kare.

 Step 3 – Add Kijiye New Post

Hamne abhi website ki link choose kar li he.
Hamari website abhi thodi hi der me ready ho jayegi.

Free Website Kaise Banaye
Free Website Kaise Banaye

Agle screen par New post par click kare.
Hume ab hamara Article dalna hai, Agle screen par aapka article likhe.

Naya Article Likhe
Naya Article Likhe

Article likhne ke bad Publish button par click kare.
Read More »

Monday, 21 August 2017

Youtube Videos Ko Mp3 Songs Me Convert Kar Download Kaise Kare ~ niit post

Jo log songs sunna jyada pasand karte hai or internet use karte hai to YouTube par online videos jarur dekhte honge. magar YouTube par MB data bahut jyada kharch hoti hai. iska aasan sa jawab hai apne favorite songs, videos ko download kar liya jaye. but aaj kal videos file HD high quality ki hoti hai. ayse me iske liye bahut internet data chahiye. so agar aap apne favorite songs ko YouTube se direct mp3 me convert kar download kar sako to kitna better hoga.
How To Convert Youtube Video in Mp3v Songs
Maine apni pichli post Youtube Se Video Download Kaise Kare Bina Kisi Sofware Ke me btaya tha ki aap kaise YouTube se apna pasandida video direct download kar sakte ho. aaj is post me aapko btane ja raha hu ki YouTube par apne faorite video ko mp3 songs me convert kar download kaise kare.
Youtube sirf video dekhne ke liye hi nahi bana hai. balki aap bhi is par apne videos upload kar money earn kar sakte ho.
Agar aap bhi internet se paise kamana chahate ho to aap upar di post par jaye. aapko YouTube se paise kamane ki puri jankari details me milegi.
Youtube se log lakho kama rahe hai. aap bhi kama sakte ho. iske liye aapko sirf video bana kar YouTube par upload karne hai. or jab koi aapki video dekhega to video me ads show honge un ads par koi click karega to aapki income hogi. ye income $0.20 to $10 dollar tak ho sakti hai.
By the way hum bat kar rahe the YouTube par videos ko mp3 me convert kare download karne ki to aayiye iske bare me mai aapko details se bta raha hu. aapko bas niche diye kuch simple step follow karne hai.

Youtube Par Videos Ko Mp3 Songs Me Convert Kar Ke Download Kaise Kare

Youtube se movies, videos and songs download karna gaie kanooni hai. google iski permission nahi deta hai. but hum YouTube par se videos ka link le kar use kisi or site se download kar sakte hai. is post me mai aapko aysi hi ek site ke bare me btane wala hu. jo aapke favorite YouTube videos ko mp3 me convert karegi. or fir aap usko aasani se download kar sakte ho.
Aapko bas is site me apne favorite YouTube videos songs ka url enter karna hai. or ye website aapke videos ko mp3 me conver kar degi. chaliye mai aapko step by step btata hu.
Step 1:
Sabse pahle aap YouTube par ja kar apne favorite video ka link copy kar le. aap kitni bhi vadi video ko mp3 me convert kar sakte ho. so ye aapko tay karna hai ki aapke pas kitna MBdata hai or aap kitni MB ka video abhi mp3 me convert kar sakte ho.
Step 2:
Ab aap That Mp3 website par jaye or apne favorite video ka link search bar me paste kare.
  1. apne favorite video ka URL add kare.
  2. Convert par click kare ya fir Enter key button dabaye.
YOUTUBE TO MP3 CONVERTER
Step 3:
Aap jaise hi convert par click karoge ya enter key button press karoge to aapka video mp3 song me convert hona start ho jayega.
Jaise jaise aapkaa video convert hota jayega wese wese play bhi hota rahega. finaly jab aapka video completly mp3 songs me convert ho jayega to site ke search bar ke niche download kar option aa jayega. aap is par click kar ke apna favorite song mp3 me download kar sakte ho.
  1. apne favorite video ko mp3 me download karne ke lie Start download par click kare.
Download your favorite songs
Youtube video convert hone me kitna time lagega ye bat aapke video ke size par depend karti hai. video jitna bada hoga. use mp3 me convert hone me utna hi time lagega.
Read More »

Free Mp3 Songs Music Download Karne Ki Top 20 Best Websites ~ niit post

Free mp3 downlod sites, Free music downloads sites 2017: Agar aap google me free music, free mp3 songs, free audio songs ke bare me searching karte ho to ye post aapke liye hai. Kyuki aaj main aapko is post me free music download karne ke liye top best websites ke bare me bta raha hu. In sites se aap apni man pasand ka gaana & mp3 songs download kar sakte ho.
Free Mp3 Music Songs Download Websites
Music ki apne aap me ek duniya hoti hai or jinko isme interest hota hai wo apni pasand ka song jab sunna chahate hai to us song ke liye kuch bhi kar sakte hai. Aese hi user ko apna favorite song internet par search karne me kafi time west karna padta hai. But kya ho agar aapko apna favorite song kuch hi seconds me mil jaye.
Yes aapko in websites se apni pasand ka song kuch hi second me mil jayega. Ab aapko iske liye bar bar google me searching karne ki jarurat nahi hai. Ye 20+ Free MP3 Download sites aapki isme help karegi. Aap apne PC, Laptop, Smartphone, Android, iPad, iPhone, iOS and kisi bhi device par apna favorite song sun sakte ho.

Top 20+ Best Sites Free Mp3 Music Songs Download Karne Ke Liye in Hindi

Music me kuch logo ka itna interest hota hai ki wo apne khali time me apna favorite songs sunna pasand karte hai. Smartphone me earphone and desktop me high volume speaker ke sath music sunne wale aapko har jagah mil jayenge or ho sakta hai aapko bhi isme interest ho.
Free Mp3 Download Sites list:
Online music, videos, movies, comedy, animation and all other material ke liye internet par YouTube sabse badi website hai. Is site par humko humari pasand ka sabkuch mil jata hai. Google ke bad ye site world wide sabse jyada popular hai.
But problem ye hai ki is par videos hi milte hai. Ab agar koi apne favorite song ko mp3 me sunna pasand kre to kya kare. Iska bhi solution hai aap YouTube ke videos ko Mp3 converter ki help se mp3 song me convert kar sakte ho. Is process me 5 minute se bhi kam time lagta hai.
Aapko bas YouTube video ka URL copy kar mp3 converter tool me dalna hai. Iske bare me mail already Youtube Videos Ko Mp3 Songs Me Convert Kar Download Kaise Kare post me iska tarika bta chuka hu. So ab bas aapko YouTube par apni pasand ka video search karna hai.
Youtube video ke liye music set karne ke liye audio library offer karta hai jime bhi aapko kei tarah ki best tunes mil jayegi. Youtube audio library me aapko 200+ collection tunes mil jayegi.
Youtube ke bad music, mp3 songs ki ye dusri sabse badi site hai. Jo log mp3 melodies sunna pasand karte hai unke liye ye or bhi bsdhiya site hai. Aap jab chaho is site par online koi bhi song play kar sakte ho. Sath hi aap is site par pani iTunes bhi upload kar sakte ho.
is par aapko bahut sari free mp3 download sites milegi. Aapko jo pasand ho aap us par visit kar sakte hai. Is par aapko 30 million tunes or 50000+ melodies milegi. Aap song sunne ke liye is par alag se channel bhi bana sakte ho.
Free music sunne ke liye radio bhi free mp3 download karne ki top best websites me se ek hai. Is par aapko music, articles, shows, graphs, sweepstakes and other category songs milenge. Aap cass and area ke anusar music select kar sakte ho.
Radio site apni pasand ki tune download karne ke liye bak isabhi site se best site hai. So aap is par register karke isse connect bhi rah sakte hai. Jisse aapko new songs ki notification bhi milti rahegi.
ye site mp3 tunes library ki tarah hai. Is site par itne sare songs hai ki aap old se le kar new tak koi bhi movie ka song download kar sakte ho.
Is site par aap apne favorite artist ke name ke anusar songs search kar sakte ho. Iske step bahut easy hai koi bhi aasani se apna pasandida song search kar sakta hai.
Android, iOS, iPad, windows and all other smartphone user ke liye favorite mp3 song download karne ki ye bhi ek best site hai. Is site par aap apni pasand ki tune easily download kar sakte ho.
Mp3juice site bhi mp3 song download karne ki best website hai. Is apr aapko high quality ke mp3 song bhi mil jayenge. Aapko bas is site par kisi bhi song ka short name type karna hai uske bad aapka favorite song aapke samne hoga.
Aap is iste par YouTube video ka URL copy karke paste kare ye site us video ko mp3 song me convert kar ke de degi. Yani aap is site apr se mp3 song download karne ke sath video ko mp3 audio me convert bhi kar sakte ho.
Jamendo world ki sabse biggest music sites me se ek hai. Is site par aap songs ko distribute bhi kar sakte ho.  Mostly music sites par bahut jyada advertising hoti hai jisse hume sahi link open karne me problem hoti hai but is site par aesa nahi hai is par aapko kam se kam ad milenge or aap easily right link open kar sakte ho.
Aap is site par label yani category ke anusar mp3 song search kar sakte ho.
8.Royalty Free Music
Music clips, loops, beats and sound effects ke liye royalty free music site online sabse bada largest selections hai. Is par free or paid dono option available hai. Aap sabhi songs ko free download nahi kar sakte or unke liye aapko payment karna hoga.
But is site par free songs bhi bahut sare hai. Jinme humare favorite songs bhi mil jate hai. Personal and educational project ke liye aap completely free mp3 song download kar sakte ho.
9. TuneIn Radio
Yeh ek place hai jaha par aap wordwide radio station sun sakte ho. Halanki ab iska time nahi raha but aaj bhi bahut se mobile user online radio sunte hai. Iski jarurat hume tab hoti hai jab humare pas internet pack na ho.
Actually, mp3 song ko online sune ya use download karke dono hi tarah se internet data lagta hai but radio station par song sunne par koi charge nahi lagta hai. Aap free me apna favorite song sun sakte ho. Ye unke liye bhi better hai jo net pack khatm hone ke bad bhi song sunna nahi chord sakte.
10. Groove Shark:
Ye free mp3 download sites ka ek group hai. Isme bahut sari music sites shamil hai jin par thousands music song available hai. Music song, album, playlist yaha aapko sabkuch milega.
Isme MP3.com, Jamendo, Noice trade, Free music archive, Jal legend, Loud crowd jaisi bahut si websites shamil hai. Ab ye kahne ki ki jarurat nahi hai ki itn isari sites par aapko apna har ek favorite song mil jayega.
11. 8stracks.com: Free Mp3 Music Download Sites
12. Deezer.com: Free Mp3 Music Download Sites
13. Mp3lee.com: Free Mp3 Music Download Sites
14. Beemp3s.com: Free Mp3 Music Download Sites
15. Audiomack.com: Free Mp3 Music Download Sites
16. Last.fm: Free Mp3 Music Download Sites
17. Mp3.com: Free Mp3 Music Download Sites
18. Mp3base.cc: Free Mp3 Music Download Sites
19. Ep3world2.co: Free Mp3 Music Download Sites
20. Play.spotify.com: Free Mp3 Music Download Sites
Finally, Ab aap easily in sites ki help se apna favorite song bina time west kiye just kuch minutes me find kar sakte ho. So listen your favorite songs now and enjoy.
Read More »

Friday, 18 August 2017

APK Expansion Files in Android with Example ~ niit post

Introduction

          Google Play currently requires that your APK file be no more than 50MB. For most applications, this is plenty of space for all the application's code and assets. However, some apps need more space for high-fidelity graphics, media files, or other large assets. Previously, if your app exceeded 50MB, you had to host and download the additional resources yourself when the user opens the app. Hosting and serving the extra files can be costly, and the user experience is often less than ideal. To make this process easier for you and more pleasant for users, Google Play allows you to attach two large expansion files that supplement your APK.

         Google Play hosts the expansion files for your application and serves them to the device at no cost to you. The expansion files are saved to the device's shared storage location (the SD card or USB-mountable partition; also known as the "external" storage) where your app can access them. On most devices, Google Play downloads the expansion file(s) at the same time it downloads the APK, so your application has everything it needs when the user opens it for the first time. In some cases, however, your application must download the files from Google Play when your application starts.

Overview


Each time you upload an APK using the Google Play Android Developer Console, you have the option to add one or two expansion files to the APK. Each file can be up to 2GB and it can be any format you choose, but we recommend you use a compressed file to conserve bandwidth during the download. Conceptually, each expansion file plays a different role:
  • The main expansion file is the primary expansion file for additional resources required by your application.
  • The patch expansion file is optional and intended for small updates to the main expansion file.

Screen: 
Please  see below screen for how apk expansion work.  




File name format

Each expansion file you upload can be any format you choose (ZIP, PDF, MP4, etc.).
[main|patch]...obb 
There are three components to this scheme:
 
 main or patch
Specifies whether the file is the main or patch expansion file. There can be only one main file and one patch file for each APK.

<expansion-version>
This is an integer that matches the version code of the APK with which the expansion is first associated.
Developer Console allows you to re-use an uploaded expansion file with a new APK,

<package-name>
Your application's Java-style package name.

For example, suppose your APK version is 314159 and your package name is com.example.app. If you upload a main expansion file, the file is renamed to:

main.314159.com.example.app.obb

Ex. main.1.packagename.obb.zip name used in my project.

Storage location

When Google Play downloads your expansion files to a device, it saves them to the system's shared storage location. To ensure proper behavior, you must not delete, move, or rename the expansion files. In the event that your application must perform the download from Google Play itself, you must save the files to the exact same location.

The specific location for your expansion files is:

<shared-storage>/Android/obb/<package-name>/

<shared-storage> is the path to the shared storage space, available from getExternalStorageDirectory().

<package-name> is your application's Java-style package name, available from getPackageName().

Ex: sdcard/Android/obb/packagename/main.1.packagename.obb

If you must unpack the contents of your expansion files, do not delete the .obb expansion files afterwards and do not save the unpacked data in the same directory
For example, we've provided a library project called the APK Expansion Zip Library that reads your data directly from the ZIP file.

Note: Unlike APK files, any files saved on the shared storage can be read by the user and other applications.

Download process


Most of the time, Google Play downloads and saves your expansion files at the same time it downloads the APK to the device. However, in some cases Google Play cannot download the expansion files or the user might have deleted previously downloaded expansion files. To handle these situations, your app must be able to download the files itself when the main activity starts, using a URL provided by Google Play.

The download process from a high level looks like this:

  1. User selects to install your app from Google Play.
  2. If Google Play is able to download the expansion files (which is the case for most devices), it downloads them along with the APK.
    If Google Play is unable to download the expansion files, it downloads the APK only.
  3. When the user launches your application, your app must check whether the expansion files are already saved on the device.
    1. If yes, your app is ready to go.
    2. If no, your app must download the expansion files over HTTP from Google Play. Your app must send a request to the Google Play client using the Google Play's Application Licensing service, which responds with the name, file size, and URL for each expansion file. With this information, you then download the files and save them to the proper storage location.
Caution: It is critical that you include the necessary code to download the expansion files from Google Play in the event that the files are not already on the device when your application starts. As discussed in the following section about Downloading the Expansion Files, we've made a library available to you that greatly simplifies this process and performs the download from a service with a minimal amount of code from you.

Use  Download Library to implement your download behavior. Its Very Easy to use & Implement Downloading behavior using Download Library. you can also take reference from Sample Demo App.

Downloading the Expansion files

In most cases, Google Play downloads and saves your expansion files to the device at the same time it installs or updates the APK. This way, the expansion files are available when your application launches for the first time. However, in some cases your app must download the expansion files itself by requesting them from a URL provided to you in a response from Google Play's Application Licensing service.

The basic logic you need to download your expansion files is the following:

1. When your application starts, look for the expansion files on the shared storage location (in the Android/obb/<package-name>/ directory).

a. If the expansion files are there, you're all set and your application can continue.

b. If the expansion files are not there: 

1.) Perform a request using Google Play's Application Licensing to get your app's expansion file names, sizes, and URLs.

2.) Use the URLs provided by Google Play to download the expansion files and save the expansion files. You must save the files to the shared storage location (Android/obb/<package-name>/) and use the exact file name provided by Google Play's response.

Note: 
The URL that Google Play provides for your expansion files is unique for every download and each one expires shortly after it is given to your application.

Note: Whether your application is free or not, Google Play returns the expansion file URLs only if the user acquired your application from Google Play.

Sample Demo App: 

You can Download Sample App from SDK Manager. And Take Reference from it.
You have to download below Library from SDK Manager in Eclipse. 

Google Play Licensing Library

Google Play APK Expansion Library

Download from SDK Manager


You have to add total three Library in your Project for APK Expansion




1) APK Expansion Zip Library (SDK/extras/google/play_apk_expansion/zip_file)
2) Application Licensing (SDK/extras/google/market_licensing)
3) Downloader Library (SDK/extras/google/play_apk_expansion/downloader_library)

APK Expansion Zip Library  
This is an optional library that helps you read your expansion files when they're saved as ZIP files. Using this library allows you to easily read resources from your ZIP expansion files as a virtual file system. 

Downloader Library
To use APK expansion files with your application and provide the best user experience with minimal effort on your behalf, we recommend you use the Downloader Library that's included in the Google Play APK Expansion Library package. This library downloads your expansion files in a background service, shows a user notification with the download status, handles network connectivity loss, resumes the download when possible, and more.

Application Licensing 
If the files are not on the device, use Google Play's Application Licensing service to request URLs for the expansion files, then download and save them.  


Downloaded Sample Demo Available at below paths in your system.

ex. /Android SDK / extras/ google / play_apk_expansion/ 


 Declaring user permissions



    

Note:  By default, the Downloader Library requires API level 4, but the APK Expansion Zip Library requires API level 5. 


Implementing the downloader service

In order to perform downloads in the background, the Downloader Library provides its own Service subclass called DownloaderService that you should extend. In addition to downloading the expansion files for you, the DownloaderService also:

All you need to do is create a class in your application that extends the DownloaderService class and override three methods to provide specific application details:

getPublicKey()
  
This must return a string that is the Base64-encoded RSA public key for your publisher account, available from the profile page on the Developer Console (see Setting Up for Licensing).

getSALT()
  
This must return an array of random bytes that the licensing Policy uses to create an Obfuscator. The salt ensures that your obfuscated SharedPreferences file in which your licensing data is saved will be unique and non-discoverable.

getAlarmReceiverClassName()
  
This must return the class name of the BroadcastReceiver in your application that should receive the alarm indicating that the download should be restarted (which might happen if the downloader service unexpectedly stops).

For example, here's a complete implementation of DownloaderService:

public class SampleDownloaderService extends DownloaderService {
    // You must use the public key belonging to your publisher account

    public static final String BASE64_PUBLIC_KEY = "YourLVLKey";
    // You should also modify this salt
    public static final byte[] SALT = new byte[] { 1, 42, -12, -1, 54, 98,
            -100, -12, 43, 2, -8, -4, 9, 5, -106, -107, -33, 45, -1, 84
    };

    @Override
    public String getPublicKey() {
        return BASE64_PUBLIC_KEY;
    }

    @Override
    public byte[] getSALT() {
        return SALT;
    }

    @Override
    public String getAlarmReceiverClassName() {
        return SampleAlarmReceiver.class.getName();
    }
}

Notice: You must update the BASE64_PUBLIC_KEY value to be the public key belonging to your publisher account. You can find the key in the Developer Console under your profile information. This is necessary even when testing your downloads.

Remember to declare the service in your manifest file:


    
    ...

 
 
Note: You have to add your BASE64 public key in  SampleDownloaderService in your app.
This key you can get when you create app in Google Market. 
 

Implementing the alarm receiver

In order to monitor the progress of the file downloads and restart the download if necessary, the DownloaderService schedules an RTC_WAKEUP alarm that delivers an Intent to a BroadcastReceiver in your application. You must define the BroadcastReceiver to call an API from the Downloader Library that checks the status of the download and restarts it if necessary.

You simply need to override the onReceive() method to call DownloaderClientMarshaller.startDownloadServiceIfRequired().

For example:

public class SampleAlarmReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        try {
            DownloaderClientMarshaller.startDownloadServiceIfRequired(context, intent,
                    SampleDownloaderService.class);
        } catch (NameNotFoundException e) {
            e.printStackTrace();
        }
    }
}
 
Notice that this is the class for which you must return the name in your
 service's getAlarmReceiverClassName() method (see the previous 
section). 
 
Remember to declare the receiver in your manifest file:
 

    
    ...

 
 

Activity for Expansion Handling

public class VideoDownloaderActivity extends Activity implements
        IDownloaderClient {


   /**
     * Here is where you place the data that the validator will use to determine
     * if the file was delivered correctly. This is encoded in the source code
     * so the application can easily determine whether the file has been
     * properly delivered without having to talk to the server. If the
     * application is using LVL for licensing, it may make sense to eliminate
     * these checks and to just rely on the server.
     */
    private static final XAPKFile[] xAPKS = { new XAPKFile(true, // true
                                                                    // signifies
                                                                    // a main
                                                                    // file
            1, // the version of the APK that the file was uploaded
                // against
            191696333L // the length of the file in bytes
    ),

 private class CopyTask extends AsyncTask<Void, Void, Boolean> {

        private ProgressDialog mProgressDialog;
        private Context context;

        public CopyTask(Context context) {
            this.context = context;

        }

        /**
         * Display the dialog first when the webservice call.
         */
        @Override
        protected void onPreExecute() {
            super.onPreExecute();

            if (context != null) {
                mProgressDialog = ProgressDialog.show(context, "",
                        context.getString(R.string.copy_video_message), true,
                        false);

            }

        }

        /**
         * Call the webservice and parse the data from the service in
         * background.
         */
        @Override
        protected Boolean doInBackground(Void... params) {

            // return wsLinks.executeService(currentPage);
            for (XAPKFile xf : xAPKS) {

                String fileName = Helpers.getExpansionAPKFileName(
                        VideoDownloaderActivity.this, xf.mIsMain,
                        xf.mFileVersion);

                if (!Helpers.doesFileExist(VideoDownloaderActivity.this,
                        fileName, xf.mFileSize, false))
                    return true;
                fileName = Helpers.generateSaveFileName(
                        VideoDownloaderActivity.this, fileName);
                ZipResourceFile zrf;

                try {

                    zrf = APKExpansionSupport.getAPKExpansionZipFile(
                            VideoDownloaderActivity.this, 1, 0);

                    File path = new File(
                            Environment.getExternalStorageDirectory()
                                    + File.separator
                                    + getString(R.string.app_name));
                    if (!path.exists()) {
                        // create a File object for the
                        // parent directory
                        File photoDirectory = new File(
                                path.getAbsolutePath());
                        // have the object build the
                        // directory structure, if needed.
                        photoDirectory.mkdirs();
                    } else {
                        if (path.isDirectory()) {
                            String[] children = path.list();
                            Log.v(LOG_TAG, "file length:" + children.length);
                            for (int i = 0; i < children.length; i++) {
                                new File(path, children[i]).delete();
                            }
                        }

                    }

                    for (ZipEntryRO entry : zrf.getAllEntries()) {
                        Log.v(LOG_TAG, "name:" + entry.mFileName);
                        DataInputStream is = new DataInputStream(
                                zrf.getInputStream(entry.mFileName));
                        // AssetFileDescriptor af =
                        // zrf.getAssetFileDescriptor(entry.mFileName);
                        long length = entry.mCompressedLength;
                        byte[] buf = new byte[1024 * 256];
                        Log.v("assetfilediscripter", "" + length);
                        // FileOutputStream fos = new FileOutputStream("");

                        // OutputStream stream = new BufferedOutputStream(new
                        // FileOutputStream("/storage/sdcard0/Download/sample.mp3"));

                        String[] bits = entry.mFileName.split("/");
                        String lastOne = bits[bits.length-1];

                        Log.v(LOG_TAG, "path:" + path + ":"+ lastOne);

                        OutputStream stream = new BufferedOutputStream(
                                new FileOutputStream(path + "/" 
                                        + lastOne));
                        int bufferSize = 1024;
                        byte[] buffer = new byte[bufferSize];
                        int len = 0;
                        while ((len = is.read(buffer)) != -1) {
                            stream.write(buffer, 0, len);
                        }
                        if (stream != null)
                            stream.close();

                        // break;

                    }
                    return true;
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                    return false;

                }

            }
            return true;

        }

        /**
         * onPostExecute method after called webService and Set the data into
         * adapter after background task is complete. this method set footerView
         * into listView according to totalPAge.
         */
        @Override
        protected void onPostExecute(Boolean result) {
            super.onPostExecute(result);
            if (mProgressDialog != null  && mProgressDialog.isShowing()) {
                mProgressDialog.dismiss();
            }

            if (result) {
                finish();
                Intent intent = new Intent(VideoDownloaderActivity.this,
                        VideoListActivity.class);
                startActivity(intent);
            } else {
                errorDialog(context, context.getString(R.string.copy_failed));
            }

        }

    }
}
 

Testing Your Expansion Files

Before publishing your application, there are two things you should test: Reading the expansion files and downloading the files.

Testing file reads


Before you upload your application to Google Play, you should test your application's ability to read the files from the shared storage. All you need to do is add the files to the appropriate location on the device shared storage and launch your application:

1.) On your device, create the appropriate directory on the shared storage where Google Play will save your files.

For example, if your package name is com.example.android, you need to create the directory Android/obb/com.example.android/ on the shared storage space. (Plug in your test device to your computer to mount the shared storage and manually create this directory.)

2.) Manually add the expansion files to that directory. Be sure that you rename your files to match the file name format that Google Play will use.

For example, regardless of the file type, the main expansion file for the com.example.android application should be main.0300110.com.example.android.obb. The version code can be whatever value you want. Just remember:

  • The main expansion file always starts with main and the patch file starts with patch.
  • The package name always matches that of the APK to which the file is attached on Google Play.
3.) Now that the expansion file(s) are on the device, you can install and run your application to test your expansion file(s).

Here are some reminders about handling the expansion files:

  • Do not delete or rename the .obb expansion files (even if you unpack the data to a different location). Doing so will cause Google Play (or your app itself) to repeatedly download the expansion file.
  • Do not save other data into your obb/ directory. If you must unpack some data, save it into the location specified by getExternalFilesDir().
Testing file download

Because your application must sometimes manually download the expansion files when it first opens, it's important that you test this process to be sure your application can successfully query for the URLs, download the files, and save them to the device.

To test your application's implementation of the manual download procedure, you must upload your application to Google Play as a "draft" to make your expansion files available for download:

1.) Upload your APK and corresponding expansion files using the Google Play Developer Console

2.) Fill in the necessary application details (title, screenshots, etc.). You can come back and finalize these details before publishing your application.

Click the Save button. Do not click Publish. This saves the application as a draft, such that your application is not published for Google Play users, but the expansion files are available for you to test the download process.

3.) Install the application on your test device using the Eclipse tools or adb.

4.) Launch the app.

If everything works as expected, your application should begin downloading the expansion files as soon as the main activity starts.


References: http://developer.android.com/google/play/expansion-files.html
Read More »