Created
December 25, 2014 16:17
-
-
Save mbalex99/d64dc290f26aa47870b7 to your computer and use it in GitHub Desktop.
Getting Package Name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In your application, you can retrieve it with getPackageName() | |
String packageName = getApplicationContext().getPackageName(); | |
String apiUrl; | |
if(packageName.equals("com.mycompany.myapp")){ | |
apiUrl = "myapi.com" | |
} | |
if(packageName.equals("com.mycompany.myapp.dev")){ | |
apiUrl = "dev.myapi.com" | |
} | |
if(packageName.equals("com.mycompany.myapp.local")){ | |
apiUrl = "10.0.0.2:8080" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment