Reputation: 8058
I am making a project where I want to integrate GCM
and Google sign in
but the problem is both have google-services.json
configuration file which we need to add in our project.
So, how can I integrate both
google-services.json
configuration file in my project.
Here is my one of the configuration file
{
"project_info": {
"project_id": "default-xxx",
"project_number": "xxx",
"name": "xxx"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:xxx",
"client_id": "x.package",
"client_type": 1,
"android_client_info": {
"package_name": "x.package_name"
}
},
"oauth_client": [],
"api_key": [],
"services": {
"analytics_service": {
"status": 1
},
"cloud_messaging_service": {
"status": 1,
"apns_config": []
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"google_signin_service": {
"status": 1
},
"ads_service": {
"status": 1
}
}
}
],
"client_info": [],
"ARTIFACT_VERSION": "1"
}
Upvotes: 7
Views: 12780
Reputation: 8058
Finally I have done it as follows:
Step1: Open your desired google service page in my case its google sign in and GCM. There will be a button saying Get configuration file, click on that and input your details and get the configuration files.
Step2: Check both of the configuration file it would have same configuration in project_info
object and client_info
object. The difference would be in services
object where you have to check for status if you have added two or more service the status value would be 2
which means they are enabled services. You can see in below configuration file which I have generated for two of the services which is Google sign in and GCM.
You just have to check your status values in services object where it is saying 2 for all the services you have integrated in your project is the configuration file you have to add.
{
"project_info": {
"project_id": "xxxxxxxxxx",
"project_number": "xxxxxxxx",
"name": "xxxxxxxxxxx"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "xxxxxxxxxxx",
"client_id": "xxxxxxxxxxx",
"client_type": 1,
"android_client_info": {
"package_name": "xxxxxxxxxx"
}
},
"oauth_client": [
{
"client_id": "xxxxxxxxxx",
"client_type": 1,
"android_info": {
"package_name": "xxxxxxxx",
"certificate_hash": "xxxxxxxxxxx"
}
}
],
"api_key": [],
"services": {
"analytics_service": {
"status": 1
},
"cloud_messaging_service": {
"status": 2, <======= this is my gcm service status
"apns_config": []
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"google_signin_service": {
"status": 2 <===== this my google sign in service status
},
"ads_service": {
"status": 1
}
}
}
],
"client_info": [],
"ARTIFACT_VERSION": "1"
}
Note: I am using Google sign in service so its generating oauth_client field value also which you wouldn't get if you generate only for GCM.
Upvotes: 8
Reputation: 739
You do not need two different google-services.json files. Both will have identical configurations. These configuration files are unique for every project irrespective of how many services you have activated.
Prior generating the configuration file, ensure you have activated both the services. The generated configuration file will be valid for both.
Follow the "Continue to Sign In" link that appears below the "Download and install Configuration" link for documentation regarding what to do next.
Upvotes: 5