-
Notifications
You must be signed in to change notification settings - Fork 1
Setup
##Integrating Google Play Services
The Google Play services SDK gets installed at the following location in the Android SDK directory.
/extras/google/google_play_services/
To use the client library you need to import google-play-services_lib project into your Eclipse workspace. For this go to File > Import. Then, select Android > Existing Android Code into Workspace. Click Next. In the Import Projects dialog, browse to the following directory and specify it as the Root Directory.
/extras/google/google_play_services/libproject
Import Play services library Select google-play-services_lib and Copy projects into workspace. Click Finish. A copy of the library project will get imported into your workspace.
In order to obtain an API key you need to first create an API project through the Google APIs Console. If you log in to the console for the first time then you'd be prompted to create a project. Create API project Click Create project. You'll then see the Dashboard for the API project. It's a good idea to create a new project for GCM. API console Dashboard Click on the project drop-down on the left side panel. Click Create... and enter a name for the project then click Create project. The project will be created and the Dashboard will refresh to reflect the current project. Note down the Project Number displayed in the Dashboard Project Summary section. This number is also visible in the browser URL something like:
The project number (for eg. 4815162342) will be used later as the GCM sender ID.
Next, click on Services on the left side panel to see all services provided by Google. Available Services Find Google Cloud Messaging for Android and click on the switch to activate the service. Activate Google Cloud Messaging for Android Next, click on API Access on the left side panel to open the API Access page. Simple API key Copy the API key as it will be used later, and you may log out of the console.
In Eclipse, go to File > New > Project and in the New Project dialog, expand Android folder to select Android Project. In New Android Project dialog enter the project details as follows.
Application Name: Insta Chat Project Name: InstaChat Package Name: com.appsrox.instachat Minimum Required SDK: API 15 Compile With: API 15
Accept the defaults and click Next, Next, Next, Finish. The project gets created in your workspace. Next we need to add google-play-services_lib project as a library to our project. Right click on the project and go to Properties > Android. Add Google Play services library In the Library section, click Add and then select google-play-services_lib and click OK. This will add google-play-services_lib as a library to the project so we can now use GoogleCloudMessaging API.