Back to project page StreamHub-Android-Reviews-App.
The source code is released under:
MIT License
If you think the Android project StreamHub-Android-Reviews-App listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package livefyre; /* ww w. ja v a 2 s. com*/ import android.app.Application; import android.content.Context; import android.content.SharedPreferences; import android.net.ConnectivityManager; import android.net.NetworkInfo; public class LivefyreApplication extends Application { private static final int TIMEOUT_VALUE = 10000; private static final String LIVEFYRE = "livefyre"; private SharedPreferences sharedPreferences; @Override public void onCreate() { super.onCreate(); AppSingleton.getInstance().setApplication(this); init(); } private void init() { sharedPreferences = getApplicationContext().getSharedPreferences( LIVEFYRE, MODE_PRIVATE); } public void saveDataInSharedPreferences(String key, String sessionId) { SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString(key, sessionId); editor.commit(); } public String getDataFromSharedPreferences(String reqString) { return sharedPreferences.getString(reqString, ""); } public boolean isDeviceConnected() { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo ni = cm.getActiveNetworkInfo(); return (ni != null); } public int getRequestTimeOut() { try { return TIMEOUT_VALUE; } catch (NumberFormatException e) { return 2000; } } public String getErrorStringFromResourceCode(int resourceCode) { return getResources().getText(resourceCode).toString(); } }