Thursday, March 30, 2017

How to get SHA-1 fingerprint Certificate

Generating SHA-1 fingerprint Certificate

1. Open Android Studio

2. Open Your Project.

3. Click 'Gradle' (Right Side Top Panel, you can see Gradle Bar)

4. Click 'Refresh' button(you can find it on top panel) which contains list of all your gradle scripts of your project.

5. Select Your Project with named (root).

6. Click Tasks---> Click Android ---> Double Click Signing Report




7. Click Gradle Console(Right Side Bottom Panel) where you can find your SHA-1 and MD5 fingerprint certificate.




If you find any query or any difficulties related this blog, you can post your comment, so i can be useful to my site visitors.

Wednesday, March 29, 2017

Getting API key for Google Maps

Create API Key for Google Maps

1. Go to Google API Console (https://console.developers.google.com/).

2. If you have opened your google API Console, then a new project named "My Project" is created automatically.


3. Select Your project, then Click 'Continue' to enable Google Maps Android API.


4. On Credentials Section, get an API Key. If you have existing API with restriction then you can use that.





5. To restrict your API Key, click 'Edit' button, then follow instructions.
   - Select Key Restrictions: 'Android apps'
   - Restrict usage to your Android apps (This is an optional if you want restrict your API Key to particular Android App)
   - Enter package name (Enter your package name of your app)
   - Enter SHA-1 certificate fingerprint.



 
6. Click Save.

7. You can use your API Key to your android app.

Tuesday, March 21, 2017

How To Fix Google AdMob Error

Google AdMob  ad error: failed to load


If You have seen error like this and code is as shown below:

// Define add below as banner
AdView mAdView = new AdView(SplashActivity.this);
mAdView.setAdUnitId(getResources().getString(‘YOUR AD UNIT ID’));
mAdView.setAdSize(AdSize.
BANNER);
RelativeLayout layout = (RelativeLayout) findViewById(R.id.
splash_layout);
RelativeLayout.LayoutParams params =
new RelativeLayout.LayoutParams(
        RelativeLayout.LayoutParams.
MATCH_PARENT,
        RelativeLayout.LayoutParams.
WRAP_CONTENT);
layout.addView(mAdView, params);
mAdView.loadAd(
new AdRequest.Builder().build());



If there is no mistakes found in your code then you should not worry.

If you have created your AdMob account recently then you should wait for 1 or 2 days. After 1 or 2 days, Your ad will works fine.


Important Notice: If you are new to AdMob then Please remember that do not click on ads while testing. If you are doing your AdMob Account will be deleted.

Friday, March 17, 2017

Create your First Android Application 'Hello World'

1. Create New Android Application.


           Select File --> New--> New Project




2. Configure your project.


      Here you can configure your project name, project location, then click Next button




3.  Set Minimum SDK    






4. Select Activity



5 Modify Layout File


Your layout file should be like this:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:paddingBottom="@dimen/activity_vertical_margin"    
                android:paddingLeft="@dimen/activity_horizontal_margin"    
                android:paddingRight="@dimen/activity_horizontal_margin"
                android:paddingTop="@dimen/activity_vertical_margin"
                tools:context="com.donix.helloworldapp.MainActivity">
    <TextView  android:layout_width="wrap_content" 
               android:layout_height="wrap_content"
               android:text="Hello World!" />
</RelativeLayout>





6. Modify Activity Java File.


Your java file should be like this:
public class MainActivity extends AppCompatActivity {

    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

// Mention your layout file where textview is defined 
        setContentView(R.layout.activity_main);
        Toast.makeText(this,"Hello World",Toast.LENGTH_LONG).show();

    }

}

7. Running Your Application.



To Run your Application,First start AVD/Emulator or Connect your phone to pc, then Click on Run 
button




Installation for Android Development



➼ Set up for Android Development Enviornment
  • JAVA JDK
  • Android SDK & NDK
  • Android Tools(Eclipse or Android Studio)
  • ADT Eclipse Plugin(If Required) 

      1. Set up Java Development Kit (JDK) 
                      You can download JDK from the given url                                                                                                http://www.oracle.com/technetwork/java/javase/downloads/index.html

              2. Android SDK & NDK

                          You can download from Android Developers.


           3. Android Tools (Eclipse or Android Studio)
                   
               ➔Eclipse IDE
                  Eclipse is a Java-Based Open Source platform that allows software developers to create a customized environment development(IDE) using plug-ins components which is created by Eclipse Team.
                   
                  Download Eclipse setup from below link and paste it in any drive and start using it.




              ➔  Android Studio 
                   Android Studio provides the fastest tools for building apps on every type of Android device.World-class code editing, debugging, performance tooling, a flexible build system, and an instant build/deploy system all allow you to focus on building unique and high quality apps.

                  Download Android Studio from given website   url. https://developer.android.com/studio/index.html