Wish Conditional compilation check package name

Emme Developer

Well-Known Member
Licensed User
Longtime User
I understood that i can create a new build configuration, and use conditional compilation to check the symbols, but i think it is a little "tedious" as you need to create new in every new project.
I think can be a good thing something like this:
B4X:
#IF packagename.contains(".company1.") then
     SignKeyFile: ...
#Else
     SignKeyFile: ....
#End if
 

Peter Simpson

Expert
Licensed User
Longtime User
@Emme Developer why not just use #SignKeyFile and #SignKeyPassword once in your Main Activity. Doing it the way that you suggest is long winded. You still leave you main key file name in private key sign, but you use #SignKeyFile and #SignKeyPassword in the Main Activity to bypass the default keystone with the one you actually want to use in that particular project. I place mine in the project attribution #Region of the Main Activity, once set I don't see it again ;)

#SignKeyFile: c:\folder\folder\b4a\mykeystorefile.keystore
#SignKeyPassword: ilovelife

It's as simple as that...
 
Last edited:

Emme Developer

Well-Known Member
Licensed User
Longtime User
@Emme Developer why not just use #SignKeyFile and #SignKeyPassword once in your Main Activity. Doing it the way that you suggest is long winded. You still leave you main key file name in private key sign, but you use #SignKeyFile and #SignKeyPassword in the Main Activity to bypass the default keystone with the one you actually want to use in that particular project. I place mine in the project attribution #Region of the Main Activity, once set I don't see it again ;)

#SignKeyFile: c:\folder\folder\b4a\mykeystorefile.keystore
#SignKeyPassword: ilovelife

It's as simple as that...
Sorry, i don't understand clearly your suggestion. You can use an IF in main activity?
I don't use it because i don't need only one signkeyfile, i need to use different sign key file based on package name. I have 2 companies and 2 signkeyfile, and using an if statement like my in first post is easier to copy and past in each project than rembember in each new project to set the right sign key file
 

Peter Simpson

Expert
Licensed User
Longtime User
Okay,
In B4A go to Tools > Private Sign Key and set your default keystore file, the one you use for yourself all the time.

Now in your Main Activity add the #SignKeyFile and #SignKeyPassword as follows @Emme Developer.

B4X:
'Your Main Activity
#Region  Project Attributes
    #ApplicationLabel: Your Customers App
    #VersionCode: 1
    #VersionName: 1.0.0.0
  
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
  
    #SignKeyFile: C:\Users\Emme\Documents\B4X\B4A\Key Strokes\yourcustomerapp.keystore
    #SignKeyPassword: thepassword
 
#End Region

Do this to all your apps that you need to use another keystore file with, you have too need to ever changed the keystore location in Tools > Private Sign Key.
 

Emme Developer

Well-Known Member
Licensed User
Longtime User
Okay,
In B4A go to Tools > Private Sign Key and set your default keystore file, the one you use for yourself all the time.

Now in your Main Activity add the #SignKeyFile and #SignKeyPassword as follows @Emme Developer.

B4X:
'Your Main Activity
#Region  Project Attributes
    #ApplicationLabel: Your Customers App
    #VersionCode: 1
    #VersionName: 1.0.0.0
 
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
 
    #SignKeyFile: C:\Users\Emme\Documents\B4X\B4A\Key Strokes\yourcustomerapp.keystore
    #SignKeyPassword: thepassword

#End Region

Do this to all your apps that you need to use another keystore file with, you have too need to ever changed the keystore location in Tools > Private Sign Key.
Thanks for your suggestion @Peter Simpson , but i already know this way. In this way i need to remember to comment/uncomment the 2 lines relative at SignKey, according to the application. If i forget this, maybe i can publish with wrong SignKey a new app. The purpose of my wish is to avoid this, by simple pasting the same If statement in each project
 
Top