android - Switch GCM Client on Development and Production -
just implement new gcm. official document,
copy google-services.json file downloaded app/ or mobile/ directory of android studio project.
anyone know how setup gradle switch development , production use different google-services.json?
i have answered similar question here different productflavors.
in case it's debug/production. don't know why need switch between production , debug think can same proposed flavors.
create 2 folders src/release , src/debug , in each of folders put corresponding google-services.json , have: src/release/google-services.json , src/debug/google-services.json
now in gradle add :
android { // set build config here right gcm configuration. //def mybuildconfig = "release" def mybuildconfig = "debug" // copy right google-services.json file app/ directory. if (mybuildconfig.equals("release")) { println "--> release copy!" copy { 'src/release/' include '*.json' '.' } } else { println "--> debug copy!" copy { 'src/debug/' include '*.json' '.' } } // other stuff }
Comments
Post a Comment