Android Open Source - android-api Android Client Config






From Project

Back to project page android-api.

License

The source code is released under:

GNU General Public License

If you think the Android project android-api listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.hoccer.api.android;
/*from   w  ww . ja  v a2 s  .  co  m*/
import java.util.UUID;

import android.content.Context;
import android.content.SharedPreferences;

import com.hoccer.api.ClientConfig;

public class AndroidClientConfig extends ClientConfig {

  // Static Methods ----------------------------------------------------

  public static String getServerNameFromSharedPreferences(Context context) {

        SharedPreferences prefs = context.getSharedPreferences(AsyncLinccer.PREFERENCES, Context.MODE_WORLD_READABLE
                | Context.MODE_WORLD_WRITEABLE);

    String tmpServerName = "https://linccer.hoccer.com/v3";
    String serverName = prefs.getString("hoccer_server", tmpServerName);

    if (tmpServerName.equals(serverName)) {
      SharedPreferences.Editor editor = prefs.edit();
      editor.putString("hoccer_server", tmpServerName);
      editor.commit();
    }
    return serverName;
  }

  public static String getFileCacheServerNameFromSharedPreferences(
      Context context) {

        SharedPreferences prefs = context.getSharedPreferences(AsyncLinccer.PREFERENCES, Context.MODE_WORLD_READABLE
                | Context.MODE_WORLD_WRITEABLE);

    String tmpServerName = "https://filecache.hoccer.com/v3";
    String serverName = prefs.getString("hoccer_filecache_server",
        tmpServerName);

    if (tmpServerName.equals(serverName)) {
      SharedPreferences.Editor editor = prefs.edit();
      editor.putString("hoccer_filecache_server", tmpServerName);
      editor.commit();
    }
    return serverName;
  }

  public static String getHocletServerNameFromSharedPreferences(
      Context context) {
        SharedPreferences prefs = context.getSharedPreferences(AsyncLinccer.PREFERENCES, Context.MODE_WORLD_READABLE
                | Context.MODE_WORLD_WRITEABLE);

    String tmpServerName = "https://hoclet-experimental.hoccer.com/v3";
    String serverName = prefs.getString("hoccer_hoclet_server",
        tmpServerName);

    if (tmpServerName.equals(serverName)) {
      SharedPreferences.Editor editor = prefs.edit();
      editor.putString("hoccer_hoclet_server", tmpServerName);
      editor.commit();
    }
    return serverName;
  }

  public static void useSettingsServers(Context context) {

    useTestingServers();
    // mLinccerUri = getServerNameFromSharedPreferences(context);
    // mFileCacheUri = getFileCacheServerNameFromSharedPreferences(context);
  }

  // Constructors ------------------------------------------------------

  public AndroidClientConfig(String applicatioName, String apiKey,
      String sharedSecret, UUID clientId, String clientName,
      String publicKey) {

    super(applicatioName, apiKey, sharedSecret, clientId, clientName,
        publicKey);
  }

  public AndroidClientConfig(String applicatioName, String apiKey,
      String sharedSecret) {

    super(applicatioName, apiKey, sharedSecret);
  }

  public AndroidClientConfig(String applicatioName, UUID clientId,
      String clientName) {

    super(applicatioName, clientId, clientName);
  }

  public AndroidClientConfig(String applicatioName) {

    super(applicatioName);
  }

}




Java Source Code List

com.hoccer.api.android.AndroidClientConfig.java
com.hoccer.api.android.AndroidLogHandler.java
com.hoccer.api.android.AndroidStreamableContent.java
com.hoccer.api.android.AsyncLinccer.java
com.hoccer.api.android.BadContentResolverUriException.java
com.hoccer.api.android.FileCacheService.java
com.hoccer.api.android.LinccLocationManager.java
com.hoccer.api.android.Updateable.java