title: Android Maps not initializing on 2g or slow internet connections
body: <p>In one of my activity I am showing google map in fragment. It's working fine with 3g or high speed internet connection. But in 2g or very slow internet connection it's hang my mobile, And after some time I get 'not responding' message. Is there any way by which i can handle this situation?
  here's the code</p>
  
  <pre><code> @Override
      protected void onCreate(Bundle savedInstanceState) {
          try {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.activity_maps);
  
              // Obtain the SupportMapFragment and get notified when the map is ready to be used.
              SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
                      .findFragmentById(R.id.map);
              mapFragment.getMapAsync(this);
  
              InitializeClient();
              InitializeDB();
  
  
          } catch (Exception e) {
              e.printStackTrace();
          }
  
          mqtt=new MQTT();
          try{
              if(ip==null){
                  System.out.println("Mqtt Initialized in Maps Activity");
                  ip="demo.aiotm.in:1883";
              }
              //mqtt.setHost("tcp://"+ip);
              mqtt.setHost("tcp://10.30.60.242:1883");
              connection = mqtt.blockingConnection();
              connection.connect();
          }catch (Exception e){
              e.printStackTrace();
  
          }
  
      }
  
      private void InitializeClient() {
  
          try {
              //Initializing googleApiClient
              googleApiClient = new GoogleApiClient.Builder(this)
                      .addConnectionCallbacks(this)
                      .addOnConnectionFailedListener(this)
                      .addApi(LocationServices.API)
                      .build();
              googleApiClient.connect();
  
          }catch (Exception e){e.printStackTrace();}
  
  
  
  
          if (this.mMap != null) {
  
              if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &amp;&amp; ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
                  // TODO: Consider calling
                  //    ActivityCompat#requestPermissions
                  // here to request the missing permissions, and then overriding
                  //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
                  //                                          int[] grantResults)
                  // to handle the case where the user grants the permission. See the documentation
                  // for ActivityCompat#requestPermissions for more details.
                  return;
              }else {System.out.println(":::::::::::::::::::::::::::::::::: Map Not Initialized :::::::::::::::::::::::::::::::::::::::::;");}
              mMap.setMyLocationEnabled(true);
  
  
          }
          if (googleApiClient.isConnected()||googleApiClient.isConnecting()){System.out.println("------------------------------------&gt;Api is connecting&lt;-----------------------------------");}
  
  
      }
  </code></pre>
  
  <p>the above is my initialization code for maps activity..!!, i hope this much code is enough</p>
  
  <p>NOTE:- It's not a full code. I removed some of code for security reason. </p>