Monday, July 26, 2010

Get apk from phone

When I do flashing my Samsung Spica for the first time, I lost all of my application. It means I need to download it all again from market and costs my credit. Therefore I need to get my apk from phone, and backup it all to my PC.

After doing some tests and trials based on a clue from my friend. I finally find a way to backup all of applications by downloading all installed apk from the phone, and it's really simple.

Before going further, we need to install android SDK:

  • Download android sdk from here 
  • Extract android sdk zip file to C:\
  • Add this "C:\android-sdk-windows\tools" to windows path in environment variable

And then to allow you accessing /data/app directory, you must have root permission therefore wee need to root the device. You can follow instructions in here to root your device here, but please be careful because it can bricks your device.

When you download applications from market, the system will store the apk files in /Data/app. Base on this information we can pull all of downloaded apk from phone to PC by using adb pull command.

adb pull /data/app "your destination directory"

And you can find all of your downloaded apk in "your destination directory".

Monday, July 19, 2010

PDCurses for MinGW32

As I know MinGW doesn't come with graphic control library, it isn't like borland or turbo which brings conio.h. But you can use curses library for alternative. If you use Linux you can find ncurses library, but if you're windows user you can use PDcurses.

In this tutorial I'll explain how to install PDcurses for MinGW32 compiler in MS Windows. The first things you need are Installed MinGW32 compiler and PDcurses source. You can download MinGW from here and PDcurses from here.

Set up MinGW32
  1. Install MinGW32, don't forget to install 'MinGW make' also (if you don't want to install MSys), in this case I'll install MinGW in C:\MinGW
  2. Set environment path for MinGW bin directory
    • Go to control panel
    • Click System
    • Choose Advanced tab and click "Environment Variables" button
    • Add PATH variable for user, if you have one you can skip this
    • Select PATH variable and Edit
    • In "variable value" text box, add C:\MinGW\bin, and don't forget to use ';' (semicolon) as delimiter
  3. If you didn't install MSys so you need to rename mingw32-make.exe become make.exe
  4. CD C:\MinGW\bin
    RENAME mingw32-make.exe make.exe

Install PDcurses
  1. I assume you have downloaded PDCurses source successfully, in this case I have downloaded PDCurses-3.4.tar.gz
  2. Unpack it by using winrar to C:\ and you will have C:\PDCurses-3.4 directory
  3. Compile win32 PDcurses with DLL
  4. CD C:\PDCurses-3.4\win32
    make -f gccwin32.mak DLL=Y

  5. Copy pdcurses.dll to C:\MinGW\bin
  6. COPY pdcurses.dll C:\MinGW\bin
  7. Copy pdcurses.a to be C:\MinGW\lib\libpdcurses.a
  8. COPY pdcurses.a C:\MinGW\lib\libpdcurses.a
  9. Copy pdcurses header file to C:\MinGW\lib\include
  10. CD ..
    COPY *.h C:\MinGW\include

Test PDcurses
  1. Create test.c
  2. #include <curses.h> int main()
        printw("Hello World !!!\n");
        return 0;

  3. Compile test.c and check if there is any error
  4. gcc test.c -o test -lpdcurses
  5. Test executable file. If you can see "hello world" it means everything goes well
  6. test.exe

I hope this tutorial will be helpful for who need it.