Skip to content

Instantly share code, notes, and snippets.

View dineshr93's full-sized avatar

Dinesh Ravi dineshr93

View GitHub Profile
@dineshr93
dineshr93 / Check google play service is ok
Last active September 10, 2015 06:59
Check google play service is ok
public boolean servicesOK() {
int isAvailable = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (isAvailable == ConnectionResult.SUCCESS) {
return true;
}
else if (GooglePlayServicesUtil.isUserRecoverableError(isAvailable)) {
Dialog dialog = GooglePlayServicesUtil.getErrorDialog(isAvailable, this, GPS_ERRORDIALOG_REQUEST);
dialog.show();
}
@dineshr93
dineshr93 / To Enable Google Map use these permissions
Last active September 9, 2015 14:29
To Enable Google Map use these permissions
<permission
android:name="com.example.gmapsapp.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.example.gmapsapp.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
package com.hanselandpetal.catalog;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.util.EntityUtils;
import android.net.http.AndroidHttpClient;
public class HttpManager {
textView.setMovementMethod(new ScrollingMovementMethod());
protected boolean isOnline()
{
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = cm.getActiveNetworkInfo();
if (netInfo != null && netInfo.isConnectedOrConnecting())
{
return true;
} else
{
return false;
keytool -list -alias xxx -keystore "path to debug.keystore"-storepass android -keypass android
/* LocationManager location = (LocationManager)this.getSystemService(Context.LOCATION_SERVICE); */