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
public String[] getSplitNames(Context context){ | |
try { | |
PackageManager packageManager = context.getPackageManager(); | |
PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), 0); | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | |
return packageInfo.splitNames; | |
} | |
}catch (Exception e ){ | |
e.printStackTrace(); |
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
private void translate(String textToTranslate, String targetLanguage, TranslateCallback callback) { | |
try { | |
TranslateOptions options = TranslateOptions.newBuilder() | |
.setApiKey( < api_key >) | |
.build(); | |
Translate trService = options.getService(); | |
Translation translation = trService.translate(textToTranslate,TranslateOption.targetLanguage(targetLanguage)); | |
callback.onSuccess(translation.getTranslatedText()); | |
} | |
catch(Exception e) { |
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
/* | |
* Function to pretty print data stored in a firebase DB on android device . | |
* Requires Gson library | |
*/ | |
public void debugPrintRef(final Firebase ref){ | |
ref.addListenerForSingleValueEvent(new ValueEventListener() { | |
@Override | |
public void onDataChange(DataSnapshot dataSnapshot) { |