2016年10月6日 星期四

Android Building Realtime Chat App using GCM, PHP & MySQL – Part 2

Ref : http://www.androidhive.info/2016/02/android-push-notifications-using-gcm-php-mysql-realtime-chat-app-part-2


The 1st Part covers the server side implementation of the app i.e building the REST API and the server app. In this part we’ll integrate the GCM in your new / existing android app. In the 3rd part the final chat app modules will be integrated.
This article also provides you a test interface where you can test any of your gcm apps by sending a sample push notification message.
I am also posting the project structure of the Android Project to get a clear picture file structure needed to build the final app.


Integrating GCM In Your Project

Once you got the idea of the project structure, let’s start add the gcm into your app.
1. Create a new project in Android Studio and fill all the details required. When it prompts to select a default activity, select Blank Activity and proceed.
2. The next step is downloading the google-services.json file. This configuration file contains google services information specific to your app. You can configure google services like cloud messaging, google analytics, admob, sign in with google in the same configuration file. But in this article, we’ll choose only the gcm.
Goto this doc and click on Get a configuration file which prompts you to fill quick app related information.
3. On the developer console, choose the project that you previously created in Part 1, give the current project’spackage nameEnable Google Cloud Messaging and click on Download google-services.json.



沒有留言:

張貼留言