Wednesday, 12 November 2014

Integration with Facebook


1.Install the Facebook app on your emulator 

   Steps:-

  1.  If you're developing using an emulator, you may download Facebook's Android app as an APK and install it on your development environment.
  2. Install APK File
          Make sure you have the emulator already running.
    1. Extract the contents of the zip to a folder.
    2. Find the APK file in the extracted folder, in the bin folder and rename it to a simple facebook.apkfile name. Copy this file.
    3. Browse to your SDK location on your computer and navigate to the platform-tools folder. (We need the adb here). Paste the facebook.apk file here
    4. In an empty area in the folder, with the Shift key pressed, right click and select Open command Window here (make sure you are not doing this on any file or folder).
    5. Now, at the command prompt, type this command: adb install facebook.apk
         Following the above steps will install the Facebook application on your emulator.

2. Generating App Signature for Facebook Settings
   To create facebook android native app you need to provide your Android application signature in        facebook app settings. You can generate your application signature (keyhash) using keytool that     comes with java. But to generate signature you need openssl installed on your pc. If you don’t have   one download openssl and set it in your system environment path.
 Open your command prompt (CMD) and run the following command to generate your keyhash.          While generating hashkey it should ask you password. Give password as android. If it don’t ask for   password your keystore path is incorrect.

Execute code: keytool -exportcert -alias androiddebugkey -keystore "C:\Users\Ravi\.android\debug.keystore" | openssl sha1 -binary | openssl base64

if you get error :-

'keytool' is not recognized as an internal or external command, operable program or batch file.
                                                               OR                                                                                 
'openssl' is not recognized as an internal or external command, operable program or batch file.

Check that the directory the keytool executable is in is on your path if not give it on your pc path.

my computer>>rightClick>>properties>>Advanced system settings>>environment variables>> find path in system variables>>dbl click>> paste the "C:\Program Files\Java\jdk1.6.0_16\bin">>OK

same for openssl.

Further things are easy.. :) 
Follow: http://www.androidhive.info/2012/03/android-facebook-connect-tutorial/

Saturday, 3 May 2014

Friday, 2 May 2014

Saturday, 26 April 2014

Things to remember before getting started to Android Project

1. If you want Action Bar at top of your Android App u have to select minimum required SDK to 11.

2. If you want your customized image in your app you should put them in  drawable-mdpi folder.

3. If you want your customized Font in your app you should create a new folder "font" in  assets folder.

4. For making a request from Server to Client you must be having  in-depth knowledge about Async Task() function .

5. You must create your AVD very carefully ,So that your system don't get hanged.

6. AVD takes 10-15 minutes to get started with ,So be patient enough.... you will be needing it most while developing Android App. :)

7. Never Update or Change Auto-Generated code it will fall u in trouble.

8. You have to Access or Use  src , libs , res & AndroidManifest.xml file.

9. Before Accessing to Internet /SD Card /Internal Memory u have to give permission to your AndroidManifest.xml .

10. You must clean your  project before performing Run operation.

11. You have to check your errors in LogCat ... Unlike NetBeans Output :(

12. "System.out.print" does't work in Android ... You have to use "Log "
     
    eg:- Log.e ("Test",e.getMessage())

Creating Splash Screen

Java File : SplashScreen

public class SplashScreen extends Activity {

    // Splash screen timer
    private static int SPLASH_TIME_OUT = 1000;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);

        new Handler().postDelayed(new Runnable() {        
            @Override
            public void run() {
                Intent i = new Intent(SplashScreen.this, SecondScreen.class);
                startActivity(i);
                finish();
            }
        }, SPLASH_TIME_OUT);
    }

}


XML File :activity_splash

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/splash3" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_marginBottom="10dp"
        android:gravity="center_horizontal"
        android:text="@string/first_screen_text"
        android:textColor="#ffffff"
        android:textSize="16sp" />

    <ImageView
        android:id="@+id/imgLogo"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="116dp"
        android:contentDescription="@string/logo"
        android:src="@drawable/icon" />
    
</RelativeLayout>