-
Notifications
You must be signed in to change notification settings - Fork 3
Example Distriqt
If you are using different app id with debug and release builds you may need to create multiple Distriqt keys since they are linked to your app id.
Considering the following build.gradle
file using dev.hello.world for debug app id and com.hello.world for release app id:
flair {
packageName "com.hello.world"
appId "dev.hello.world"
appName "Hello World"
appFullScreen true
appAspectRatio "portrait"
appAutoOrients false
appDepthAndStencil false
appDefaultSupportedLanguage "en"
buildTypes {
debug {
debug true
}
release {
appId "com.hello.world"
}
}
ios {
appVersionLabel "1.0.0"
buildTypes {
release {
packageTarget "ipa-app-store"
}
}
}
android {
appVersionLabel "1.0.0"
}
}
From your Distriqt account create both keys using both app id.
Then we'll add those keys from config file in your resources folder. Under app/src/main/res/values
create a new config.xml
file with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="distriqt">Copy your release distriqt key here</string>
</resources>
In your code you may then use that key with your Distriqt native extensions:
Core.init( R.string.distriqt );
FacebookAPI.init( R.string.distriqt );
Message.init( R.string.distriqt );
...
Let's now add our debug key, under app/src/debug/
folder add res/values/config.xml
and replacing the previous release key with your debug key.
Running packageIosDebug
or packageAndroidDebug
will use debug key and running packageIosRelease
or packageAndroidRelease
will use release key.
We assume main folder use the release key but we could have do the same with debug key in your main folder and release key under your release folder insteadof debug folder.
This method is also great with facebook app id, you often got a different one for development and production releases. You could use this with your server root url and any parameters that may changed from debug/release build.