Showing posts with label code. Show all posts
Showing posts with label code. Show all posts

Thursday, December 29, 2016

Code Rahasia Pada Nokia Jadul Cobacik Banjarsari

Code Rahasia Pada Nokia Jadul Cobacik Banjarsari


Code Rahasia Pada Nokia

http://images.detik.com/content/2012/05/25/317/154936_nokia3310dlm.jpg

1. Melihat IMEI (International Mobile Equipment Identity) Caranya tekan: * # 0 6 #
2. Melihat versi software, tanggal pembuatan softwre dan jenis kompresi software: * # 0 0 0 0 #
Jika tidak berhasil coba pencet * # 9 9 9 9 #
3. Melihat status call waiting: * # 4 3 #
4. Melihat nomor / nomer private number yang menghubungi ponsel anda: * # 3 0 #
5. Menampilkan nomer pengalihan telepon all calls :* # 2 1 #
6. Melihat nomor penelepon pada pengalihan telepon karena tidak anda jawab (call divert on): * # 6 1 #
7. Melihat nomor penelepon pada pengalihan telepon karena di luar jangkauan (call divert on) : * # 6 2 #
8. Melihat nomor penelepon pada pengalihan telepon karena sibuk (call divert on): * # 6 7 #
9. Merubah logo operator pada nokia type 3310 dan 3330: * # 6 7 7 0 5 6 4 6 #
10. Menampilkan status sim clock: * # 7 4 6 0 2 5 6 2 5 #
11. Berpindah ke profil profile ponsel anda, Caranya tekan tombol power off tanpa ditahan
12. Merubah seting hp nokia ke default atau pabrikan(Soft Reset): * # 7 7 8 0 #
13. Melakukan reset timer ponsel dan skor game ponsel nokia: * # 7 3 #
14. Melihat status call waiting: * # 4 3 #
15. Melihat kode pabrik atau factory code: * # 7 7 6 0 #
16. Menampilkan serial number atau nomer seri hp, tanggal pembuatan, tanggal pembelian, tanggal servis terakhir, transfer user data. Untuk keluar ponsel harus direset kembali: * # 92702689 #
17. Melihat kode pengamanan ponsel anda: * # 2 6 4 0 #
18. Melihat alamat ip perangkat keras bluetooth anda: * # 2 8 2 0 #
19. Mengaktifkan EFR dengan kualitas suara terbaik namun boros energi batere. Untuk mematikan menggunakan kode yang sama: * # 3 3 7 0 #
20. Mengaktifkan EFR dengan kualitas suara terendah namun hemat energi batere. Untuk mematikan menggunakan kode yang sama: * # 4 7 2 0 #
21. Menuju isi phone book dengan cepat di handphone nokia, Caranya tekan nomer urut lalu # contoh : 150#
22. Mengalihkan panggilan ke nomor yang dituju untuk semua panggilan: * * 2 1 * Nomor Tujuan #
23. Mengalihkan panggilan ke nomor yang dituju untuk panggilan yang tidak terjawab: * * 6 1 * Nomor Tujuan #
24. Mengalihkan panggilan ke nomor yang dituju untuk panggilan ketika telepon hp anda sedang sibuk: * * 6 7 * Nomor Tujuan #

disadur dari Kode Tombol Rahasia Ponsel Nokia - Kunci Trik Cara Buka Secret Code Akses HP/Handphone/Telepon Selular/Seluler Nokia Anda

NB Tidak Semua HP NOKIA bisa menggunakan CODE-CODE ini, ada yang khusus untuk nokia JaduL n Nokia yang terbaru

Available link for download

Read more »

Coupon code Buy Xiaomi Redmi Pro 32GB 4G Phablet From Gearbest Save 67 11

Coupon code Buy Xiaomi Redmi Pro 32GB 4G Phablet From Gearbest Save 67 11


You can now get both Golden and silver version of the Xiaomi Redmi Pro 32GB 4G Phablet flagship from gearbest.com at a discount price of only  $243.99  and $221.99 respectively you can save up to $67.11.
Read more »

Available link for download

Read more »

Saturday, December 24, 2016

Clumsy Ninja code de triche astuce gratuit hack

Clumsy Ninja code de triche astuce gratuit hack


Clumsy Ninja hack astuce triche



Clumsy Ninja code de triche astuce gratuit hack
Obtenez loutil Hack gratuit pour la coc du jeu . Obtenir des ressources de jeu illimité et dominer le jeu pour télécharger cliquez sur le lien ci-dessous






telecharger Clumsy Ninja, jeux Clumsy Ninja , télécharger Clumsy Ninja, Clumsy Ninja telecharger, jeu Clumsy Ninja , jeux de Clumsy Ninja, Clumsy Ninja astuce , astuce Clumsy Ninja, Clumsy Ninja jeux, jouer a Clumsy Ninja, Clumsy Ninja pc telecharger gratuit, Clumsy Ninja gratuit , télécharger Clumsy Ninja pc , telecharger Clumsy Ninja gratuit, Clumsy Ninja pc gratuit, mise a jour Clumsy Ninja , Ressources gratuit Clumsy Ninja , Clumsy Ninja mise a jour , Clumsy Ninja france , astuces Clumsy Ninja , Clumsy Ninja le jeu, comment télécharger Clumsy Ninja, Clumsy Ninja telecharger gratuit, comment jouer a Clumsy Ninja, Clumsy Ninja en français , Clumsy Ninja le jeu gratuit, Clumsy Ninja jouer gratuitement, Clumsy Ninja jeux gratuit, hacker Clumsy Ninja , Clumsy Ninja triche, Clumsy Ninja Ressources gratuites, code de triche Clumsy Ninja, comment hacker Clumsy Ninja , gemme illimité Clumsy Ninja , triche Clumsy Ninja , Clumsy Ninja hack Ressources, Ressources illimités Clumsy Ninja , code triche Clumsy Ninja, Clumsy Ninja gemme gratuit, generateur de Ressources Clumsy Ninja, Clumsy Ninja Ressources illimité , comment avoir des Ressources , telecharger Clumsy Ninja hack, code de triche Clumsy Ninja , Clumsy Ninja Ressources gratuit , Clumsy Ninja gems generator , glitch Clumsy Ninja , gemme gratuit Clumsy Ninja, Clumsy Ninja en ligne , gemme illimité Clumsy Ninja gratuit, Clumsy Ninja triche gratuit , Clumsy Ninja hack gratuit , Ressources gratuites Clumsy Ninja, hack de Clumsy Ninja, comment avoir Ressources illimité Clumsy Ninja, comment gagner des Ressources , Clumsy Ninja astuce Ressources , Clumsy Ninja gemme illimité, code triche Clumsy Ninja gratuit , Clumsy Ninja pc jouer , avoir des Ressources gratuit , générateur de Ressources clash, Clumsy Ninja code de triche, Clumsy Ninja astuce triche


Available link for download

Read more »

Wednesday, December 21, 2016

Color Code Generator

Color Code Generator


This Color Code Generator will help you get the six digit color code i.e hexadecimal value. It could be very effective if you want to get  a perfect combination of colors for your blog and if you have a good experience about color picking and selection matching, this will help you to make your blog to look really professional.

hex codes, color chart, color codes

The Color Code Generator is also very useful when you try to blend the Google Adsense Ads with the site content.

Instructions:- Drag the bar on the "Hue" selector to the area of your desired colour palette. - Then click inside the Brightness/Saturation area and drag the cursor until you have achieved your desired colour. The "Swatch" bar shows you the final colour result. - The hexadecimal colour code is generated in the "Hex" box. Simply copy the six digit code i.e #000000

How to add Hex Colour Code Generator

To install Hex Color Code Generator on a Blogger/Blogspot page or post, copy the following code and paste it in the post or page HTML:
<center><object border="0" classid="clsid:D27CDB6E -AE6D-11CF-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" height="480" id="obj1" width="480"> <param name="movie" value="http://www.2createawebsite.com/build/color.swf"><param name="quality" value="High"><embed src="http://www.2createawebsite.com/build/color.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="485" height="485" quality="High"></embed></object></center>
Thats it!

Available link for download

Read more »

Monday, December 19, 2016

code warna

code warna


kode warna untuk blog bingung untuk mencari kode warna, langsung aja pakai color generator, lebih mudah dan praktis. cara pakai nya mudah tinggal klik aja warnanya ntar akan dikasih kode warnanya. untuk memasang color generator ini di blog silahkan copy kode dibawah ini :



Available link for download

Read more »

Code Snippet Restricting Orientations

Code Snippet Restricting Orientations


Recent week, I have been hard finding it to restrict orientation to portrait and reverse portrait only. Today, got a solution/workaround. Thought it would be useful to share it.

The concern is to restrict the screen orientation to portrait and reverse portrait. Landscape and reverse landscape should not be supported. Hope you know that setting the screen orientation for activity(screen) can be done in either manifest file or in activity.

There is an attribute called "sensorPortrait"which exactly solves our case, as given in Android Developers forum. The point is ofcourse, its there.Works as expected in many devices. But it doesnt work in either Galaxy S3,S4 or Nexus. There is even a bug raised in google site. The challenge was to fix the orientation in these devices.

Was trying to address the issue with setting the configchanges  for orientation in manifest and trying to handle it in the onConfigurationChanged in activity. None of them worked out. Got insights from one of our old team-mate reg. (OrientationEventListener) and another app(The Ultimate Rotation Control) developer reg. (WindowOrientationListener).

Tried using the first one and referred the web and got a workaround.

PFB the workaround for my issue,
-------------------------------------------------------------------------------------------------------------
import android.os.Bundle;
import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.hardware.SensorManager;
import android.util.Log;
import android.view.Menu;
import android.view.OrientationEventListener;
import android.widget.Toast;

public class MainActivity extends Activity {
OrientationEventListener orientationListener;
    private static final int THRESHOLD = 10;

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toast.makeText(MainActivity.this, "On Create", Toast.LENGTH_SHORT).show();
        orientationListener = new OrientationEventListener(this, SensorManager.SENSOR_DELAY_NORMAL) {
            public void onOrientationChanged(int orientation) {
            if(isPortrait(orientation)){
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
            }else if(isReversePortrait(orientation)){
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
            }
            }
        };
        
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
    
@Override
protected void onPause() {
// TODO Auto-generated method stub
orientationListener.disable();

super.onPause();
}


@Override
protected void onResume() {
// TODO Auto-generated method stub
orientationListener.enable();
super.onResume();
}


private boolean isReversePortrait(int orientation){
        return orientation >= (180 - THRESHOLD) && orientation <= (180 + THRESHOLD);
    }

private boolean isPortrait(int orientation){
   return (orientation >= (360 - THRESHOLD) && orientation <= 360) || (orientation >= 0 && orientation <= THRESHOLD);
}

public boolean canShow(int orientation){
   return isReversePortrait(orientation);
}

public boolean canDismiss(int orientation){
   return isPortrait(orientation);
}
    
    
}
-------------------------------------------------------------------------------------------------------------

The values, (180, 360) are for portrait and reverse portrait modes. For Landscape and reverse landscape, you can try up with 90 and 270, where THRESHOLD is nothing but the limit within which the device can be considered as rotated to that position.Example - (360+-THRESHOLD) is portrait.

I have attached the full class file for reference.

References
http://stackoverflow.com/questions/8248274/android-detect-orientation-changed

Available link for download

Read more »

Monday, December 5, 2016

Code Snippet Installed Running Applications List

Code Snippet Installed Running Applications List


Create an Android Project as mentioned here.

List of Installed Apps:
Add the below code to get all the installed apps,

PackageManager packageManager = getPackageManager();
List<ApplicationInfo> appList =                  packageManager.getInstalledApplications(PackageManager.GET_ACTIVITIES);
for(ApplicationInfo info : appList){
    Log.i("AppInstallChecker",info.loadLabel(packageManager).toString());
 }

List of Running Apps:
Use the below code to get the list of running apps,

ActivityManager actvityManager = (ActivityManager) 
                                                                 this.getSystemService( ACTIVITY_SERVICE );
List<RunningAppProcessInfo> procInfos = actvityManager.getRunningAppProcesses();
for(RunningAppProcessInfo info : procInfos){
        Log.i("Running",info.processName);
 }

Check for App installed or not :
protected boolean isAppInstalled(String packageName) {
        Intent mIntent = getPackageManager().getLaunchIntentForPackage(packageName);
        if (mIntent != null) {
            return true;
        }
        else {
            return false;
        }

    }


Courtesy : 
http://stackoverflow.com/questions/13566479/check-app-is-installed-on-device-android-code
http://www.dreamincode.net/forums/topic/138412-android-20-list-of-running-applications/


Available link for download

Read more »

Friday, November 18, 2016

Code Gameshark Harvest Moon Back To Nature

Code Gameshark Harvest Moon Back To Nature



Hi Sobat Indrawans
Kali Ini saya Mau Posting Tentang Code HM BTN
Ini Game yang sangat legendaris bagi hidup saya
tapi kalian jika mau maen dan ingin mencoba code ini silakan
Tapi Ingat hati hati kalo nge cheat jangan banyak banyak nanti bisa game nya rusak alias broken disk
okehh bye.........

harvest moon back to nature pc code gameshark wallpaper


Otomatis Pakan Sapi dan Domba
300712F8 0001 Kotak pakan 1
300712F9 0001 Kotak pakan 2
300712FA 0001 Kotak pakan 3
300712FB 0001 Kotak pakan 4
300712FC 0001 Kotak pakan 5
300712FD 0001 Kotak pakan 6
300712FE 0001 Kotak pakan 7
300712FF 0001 Kotak pakan 8
30071300 0001 Kotak pakan 9
30071301 0001 Kotak pakan 10
30071302 0001 Kotak pakan 11
30071303 0001 Kotak pakan 12
30071304 0001 Kotak pakan 13
30071305 0001 Kotak pakan 14
30071306 0001 Kotak pakan 15
30071307 0001 Kotak pakan 16
30071308 0001 Kotak pakan 17
30071309 0001 Kotak pakan 18
3007130A 0001 Kotak pakan 19
3007130B 0001 Kotak pakan 20

Otomatis Pakan Ayam
3007130E 0001 Kotak Pakan 1
3007130F 0001 Kotak Pakan 2
30071310 0001 Kotak Pakan 3
30071311 0001 Kotak Pakan 4
30071312 0001 Kotak Pakan 5
30071313 0001 Kotak Pakan 6
30071314 0001 Kotak Pakan 7
30071315 0001 Kotak Pakan 8
30071316 0001 Kotak Pakan 9
30071317 0001 Kotak Pakan 10

Mengubah Tahun
80070CF0 00##
( Note : ## isi dengan 00 tahun 1, 01 tahun 2 , 02 tahun 3 dan
seterusnya jangan lewat 62)

Mengubah Musim
80070CF2 000#
Isi # dengan :
0 = Spring
1 = Summer
2 = Fall
3 = Winter

Mengubah Tanggal
80070CF4 00## Date
( Note : ## isi dengan 00 tanggal 1, 01 tanggal 2 , 02 tanggal 3
dan seterusnya jangan lewat 1D)

Menghentikan Waktu
80070CF8 0006
80070CFA 0000

Maksimum Kayu
80070D38 03E7

Maksimum Pakan Sapi
80070D3A 03E7

Maksimum Pakan Ikan
80070D3E 03E7

Maksimum Pakan Ayam
80070D40 03E7

Peralatan 400%
80071A40 FFFF Sickle
80071A42 FFFF Hoe
80071A44 FFFF Axe
80071A46 FFFF Hammer
80071A48 FFFF Watering

10 Hati Ayam
30074302 00FF Ayam 1
300743B6 00FF Ayam 2
3007446A 00FF Ayam 3
3007451E 00FF Ayam 4
300745D2 00FF Ayam 5
30074686 00FF Ayam 6
3007473A 00FF Ayam 7
300747EE 00FF Ayam 8
300748A2 00FF Ayam 9
30074956 00FF Ayam 10

10 Hati Sapi dan Domba
30074A0A 00FF Sapi 1
30074AC2 00FF Sapi 2
30074B7A 00FF Sapi 3
30074C32 00FF Sapi 4
30074CEA 00FF Sapi 5
30074DA2 00FF Sapi 6
30074E5A 00FF Sapi 7
30074F12 00FF Sapi 8
30074FCA 00FF Sapi 9
30075082 00FF Sapi 10
3007513A 00FF Domba 11
300751F2 00FF Domba 12
300752AA 00FF Domba 13
30075362 00FF Domba 14
3007541A 00FF Domba 15
300754D2 00FF Domba 16
3007558A 00FF Domba 17
30075642 00FF Domba 18
300756FA 00FF Domba 19
300757B2 00FF Domba 20
Available link for download

Read more »

Monday, November 7, 2016

Code Geass R1 Subtitle Indonesia Indowebster Link

Code Geass R1 Subtitle Indonesia Indowebster Link



Code Geass R1 [Subtitle Indonesia] Indowebster Link


Nih sya share, Code Geass Subtitle Indonesia, karena diluar sana banyak link mediafire yang sudah rusak, tapi sekarang yang saya share link Indowebster yang bakalan awet deh.
Link Download :

Episode 01 : 480p | 720p | 720p (Cadangan)
Episode 02 : 480p | 480p (Cadangan) | 720p | 720p (Cadangan)


Episode 03 : 480p | 720p
Episode 04 : 480p | 720p
Episode 05 : 480p | 720p
Episode 06 : 480p | 720p
Episode 07 : 480p | 720p
Episode 08 : 480p | 720p
Episode 09 : 480p | 720p
Episode 10 : 480p | 720p
Episode 11 : 480p | 720p
Episode 12 : 480p | 720p
Episode 13 : 480p | 720p
Episode 14 : 480p | 720p
Episode 15 : 480p | 720p
Episode 16 : 480p | 720p
Episode 17 : 480p | 720p
Episode 18 : 480p | 720p
Episode 19 : 480p | 720p
Episode 20 : 480p | 720p
Episode 21 : 480p | 720p
Episode 22 : 480p | 720p
Episode 23 : 480p | 720p
Episode 24 : 480p | 720p
Episode 25 : 480p | 720p
atau cari aja di Indowebster

Berterima Kasihlah kepada yang nge-sub, karena nge-sub itu sulit dibutuhkan kesabaran dan keuletan. Berbagi itu Indah rasakan sensasinya karya anda dinikmati banyak orang. 

Credit : Lulusubs

Available link for download

Read more »

Saturday, October 22, 2016

Code Undangan Pertama Whaff Rewards BS35820 0 30

Code Undangan Pertama Whaff Rewards BS35820 0 30


CODE INVITE WHAFF REWARDS

Code Undangan Pertama Whaff Rewards BS35820 + $ 0.30 - Whaff Rewards Code atau Whaff Code Undangan ini hanya muncul sekali setelah login pertama dengan Menggunakan Akun Facebook anda dan apabila anda menyetuh tombol Back atau Home halaman code tersebut akan hilang dan Anda tidak bisa Menggunakan kesempatan Dollar pertama sebesar $0.30 dari Bonus Whaff.


“Jadi saran saya untuk mendapatkan Rewards pertama gunakan Code BS35820, saya juga menerima imbalan yang sama seperti yang anda terima, ini sebagai imbalan karena saya telah memberi tahu anda cara mencari uang dengan menggunakan whaff, dan anda menerima imbalan yang sama karena telah menggunakan Code BS35820


Jadi Saya ingatkan kembali sebelum Download Whaff Apk , Code Undangan atau Code invite Whaff harus di ingat dulu Codenya BS35820,bila perlu di tulis di selembar kertas atau di dinding.hehe..



Code Whaff BS35820 Whaff Rewards Invite

Available link for download

Read more »

Thursday, October 13, 2016

code triche Blood Draw Injection Simulator gratuit astuce

code triche Blood Draw Injection Simulator gratuit astuce


Blood Draw Injection Simulator hack astuce triche



code triche Blood Draw Injection Simulator gratuit astuce
Obtenez loutil Hack gratuit pour la coc du jeu . Obtenir des ressources de jeu illimité et dominer le jeu pour télécharger cliquez sur le lien ci-dessous






telecharger Blood Draw Injection Simulator, jeux Blood Draw Injection Simulator , télécharger Blood Draw Injection Simulator, Blood Draw Injection Simulator telecharger, jeu Blood Draw Injection Simulator , jeux de Blood Draw Injection Simulator, Blood Draw Injection Simulator astuce , astuce Blood Draw Injection Simulator, Blood Draw Injection Simulator jeux, jouer a Blood Draw Injection Simulator, Blood Draw Injection Simulator pc telecharger gratuit, Blood Draw Injection Simulator gratuit , télécharger Blood Draw Injection Simulator pc , telecharger Blood Draw Injection Simulator gratuit, Blood Draw Injection Simulator pc gratuit, mise a jour Blood Draw Injection Simulator , Ressources gratuit Blood Draw Injection Simulator , Blood Draw Injection Simulator mise a jour , Blood Draw Injection Simulator france , astuces Blood Draw Injection Simulator , Blood Draw Injection Simulator le jeu, comment télécharger Blood Draw Injection Simulator, Blood Draw Injection Simulator telecharger gratuit, comment jouer a Blood Draw Injection Simulator, Blood Draw Injection Simulator en français , Blood Draw Injection Simulator le jeu gratuit, Blood Draw Injection Simulator jouer gratuitement, Blood Draw Injection Simulator jeux gratuit, hacker Blood Draw Injection Simulator , Blood Draw Injection Simulator triche, Blood Draw Injection Simulator Ressources gratuites, code de triche Blood Draw Injection Simulator, comment hacker Blood Draw Injection Simulator , gemme illimité Blood Draw Injection Simulator , triche Blood Draw Injection Simulator , Blood Draw Injection Simulator hack Ressources, Ressources illimités Blood Draw Injection Simulator , code triche Blood Draw Injection Simulator, Blood Draw Injection Simulator gemme gratuit, generateur de Ressources Blood Draw Injection Simulator, Blood Draw Injection Simulator Ressources illimité , comment avoir des Ressources , telecharger Blood Draw Injection Simulator hack, code de triche Blood Draw Injection Simulator , Blood Draw Injection Simulator Ressources gratuit , Blood Draw Injection Simulator gems generator , glitch Blood Draw Injection Simulator , gemme gratuit Blood Draw Injection Simulator, Blood Draw Injection Simulator en ligne , gemme illimité Blood Draw Injection Simulator gratuit, Blood Draw Injection Simulator triche gratuit , Blood Draw Injection Simulator hack gratuit , Ressources gratuites Blood Draw Injection Simulator, hack de Blood Draw Injection Simulator, comment avoir Ressources illimité Blood Draw Injection Simulator, comment gagner des Ressources , Blood Draw Injection Simulator astuce Ressources , Blood Draw Injection Simulator gemme illimité, code triche Blood Draw Injection Simulator gratuit , Blood Draw Injection Simulator pc jouer , avoir des Ressources gratuit , générateur de Ressources clash, Blood Draw Injection Simulator code de triche, Blood Draw Injection Simulator astuce triche


Available link for download

Read more »

Tuesday, October 11, 2016

Code Snippet SD Cards Network check

Code Snippet SD Cards Network check


In many occassions, we may find a need to check for online condition and download files to our sd card.

PFB the code to check for network availability,

public boolean isNetworkAvailable() {
    ConnectivityManager cm =
        (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo netInfo = cm.getActiveNetworkInfo();
    if (netInfo != null && netInfo.isConnectedOrConnecting()) {
        return true;
    }
    return false;

}

PFB the code for SD Card mount check,

private boolean isSDCardMounted() {
String sdCardStatus = android.os.Environment.getExternalStorageState();
return sdCardStatus.equals(android.os.Environment.MEDIA_MOUNTED);
}

PFB the code that returns available space in SD Card,

public int getFreeExtMemory()
{
    StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getAbsolutePath());
    int free  =  ((statFs.getAvailableBlocks() * statFs.getBlockSize()) / 1024);
    Log.i("AppInstallChecker", "Available Space : " + free + " KB, Required Space : "+APPSIZE_KB+" KB");
    return free;
}

Note : The methods getAvailableBlocks() & getBlockSize() from the above method/snippet is deprecated after api 18, so put a check if needed.

References :
http://stackoverflow.com/questions/5474089/how-to-check-currently-internet-connection-is-available-or-not-in-android
http://stackoverflow.com/questions/1560788/how-to-check-internet-access-on-android-inetaddress-never-timeouts
http://stackoverflow.com/questions/7429228/check-whether-the-sd-card-is-available-or-not-programatically
http://stackoverflow.com/questions/3394765/how-to-check-available-space-on-android-device-on-mini-sd-card


Available link for download

Read more »

Monday, October 10, 2016

Code Snippet Download and install apk file programmatically

Code Snippet Download and install apk file programmatically


Downloading a file can be done in many ways.

either using httpurlconnection or httpclient or download manager in android.

using httpurlconnection

String result = "";
try {
URL url = new URL(this.url);
HttpURLConnection urlConnection = (HttpURLConnection) url
.openConnection();
urlConnection.setRequestMethod("GET");
urlConnection.setDoOutput(true);
urlConnection.connect();

File sdcard = Environment.getExternalStorageDirectory();
File file = new File(sdcard, "filename.apk");

FileOutputStream fileOutput = new FileOutputStream(file);
InputStream inputStream = urlConnection.getInputStream();

byte[] buffer = new byte[1024];
int bufferLength = 0;

while ((bufferLength = inputStream.read(buffer)) > 0) {
fileOutput.write(buffer, 0, bufferLength);
}
fileOutput.close();
result = "done";

catch (MalformedURLException e) {
e.printStackTrace();
catch (IOException e) {
e.printStackTrace();
}
return result;


using download manager works from api 9,

Uri src_uri = Uri.parse("http://your.url.here/File.apk");
Uri dst_uri = Uri.parse("file:///mnt/sdcard/download/File.apk");

DownloadManager.Request req = new DownloadManager.Request(src_uri);
req
.setDestinationUri(dst_uri);
DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
dm
.enqueue(req);
There is another one line technique,
org.apache.commons.io.FileUtils.copyURLToFile(URL, File)

Below is an example,

class InstallTask extends AsyncTask<Void, Void, String> {
ProgressDialog mProgressDialog;

Context context;
String url;

public InstallTask(Context context, String url) {
this.context = context;

this.url = url;

}

protected void onPreExecute() {
mProgressDialog = ProgressDialog.show(context,
"Download", " Downloading in progress..");
}

private String downloadapk() {
String result = "";
try {
URL url = new URL(this.url);
HttpURLConnection urlConnection = (HttpURLConnection) url
.openConnection();
urlConnection.setRequestMethod("GET");
urlConnection.setDoOutput(true);
urlConnection.connect();

File sdcard = Environment.getExternalStorageDirectory();
File file = new File(sdcard, "filename.apk");

FileOutputStream fileOutput = new FileOutputStream(file);
InputStream inputStream = urlConnection.getInputStream();

byte[] buffer = new byte[1024];
int bufferLength = 0;

while ((bufferLength = inputStream.read(buffer)) > 0) {
fileOutput.write(buffer, 0, bufferLength);
}
fileOutput.close();
result = "done";

} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return result;
}

protected String doInBackground(Void... params) {
String result = downloadapk();
return result;
}

protected void onPostExecute(String result) {
if (result.equals("done")) {
mProgressDialog.dismiss();
installApk();
} else {
Toast.makeText(context, "Error while downloading",
Toast.LENGTH_LONG).show();

}
}

private void installApk() {
Intent intent = new Intent(Intent.ACTION_VIEW);
Uri uri = Uri.fromFile(new File("/sdcard/filename.apk"));
intent.setDataAndType(uri, "application/vnd.android.package-archive");
context.startActivity(intent);
}

}


just paste the above code to use it as an asynctask.

Make sure to add write external storage and internet permission.

You can add this code before calling installApk(), if you may want to check for corrupted/incomplete apk files.

private boolean isApkCorrupted() {
        boolean corruptedApkFile = false;
        try {
             new JarFile(new File("/sdcard/filename.apk"));
        } catch (Exception ex) {
             corruptedApkFile = true;
        }
        return corruptedApkFile;
    } 


Courtesy
http://bpsinghrajput.blogspot.in/2012/07/how-to-download-and-install-apk-from.html
http://gafurbabu.wordpress.com/2012/02/29/download-file-in-android-by-using-asynctask-in-background-operations/
http://stackoverflow.com/questions/11121121/android-download-an-application-using-the-downloadmanager-class
http://stackoverflow.com/questions/8338786/is-there-a-way-to-be-notified-when-apk-fails-to-being-installed

Available link for download

Read more »