Archive for the ‘Google’ Category

06
May
  • Enter wrong pattern 5 times and wait for 30 seconds.
  • Select “Forgot pattern” and enter your gmail account username and password.
  •  Make sure you use the same account that was used to activate the phone and double check the password by logging in to that Google account in a browser.
  • If you don’t have access to the original Gmail account, you will need to do a ‘hard reset and loose your settings’ and apps on the phone. The data on the memory card will not be wiped though.

 

04
May

In Cocos2D Android, positioning elements is a very tedious process. In most cases, the absolute position that we give will not be used as it is. You can fix this issue by setting the following properties of that element :

 

Consider a CCSprite object, mySprite. Now you have to set the following properties of that object before positioning it absolutely

 

mySprite.setAnchorPoint(0, 0);

mySprite.setRelativeAnchorPoint(true);

 

Now if you give the absolute position for the object, it will work fine.

, , , , ,

30
Apr

If your phone doesnt show anything when you connect an external usb disk then you need to reconfigure the USB Adapter’s pin outlet.

1 VCC Red +5 V
2 D− White Data −
3 D+ Green Data +
4 ID none Mode Identification
5 GND Black Ground

LapDock:
+5V and GND connected directly to the battery of the LapDock, TX+RX connected to the integrated USB HUB.

Docking Station:
+5V and GND connected directly to external power (5V AC), TX+RX connected to the integrated USB HUB.

Oh, in BOTH, for enabling the Host Mode, pins 4 and 5 are shortcircuited, exactly as the USB OTG specifications.

, ,

30
Apr

Tethering: the black sheep of rooting capabilities. Beloved by users who don’t want to break the bank by having to spring for another connection; hated by mobile ISP’s whose network is drained by it. In the ongoing struggle between providers and powerusers a new development has occured: reverse tethering.

What is reverse tethering?

Tethering is the ability to surf on your pc using the 3g of your phone
Reverse tethering is the opposite : surf on your phone using the ADSL of your PC.

The app is still in the early stages, and there are a couple of bugs that need to be worked out (like not being able to download from Market) but so far looks promising. The developer is also accepting feedback on models not currently listed under tested devices. So head on over to the thread here, plug in your phone, and show it some internet love.

,

30
Apr

su (short for Switch User) is a binary executable. It’s used by Android and other *nix based systems to allow a process to change the user account it is associated with. The reason it’s important from a rooting standpoint is that su without any other parameters will switch to the root user, meaning that processes that require root permission for their functionality need to invoke su (since by default they are not being run by root).

Superuser is an Android application (.apk is an Android application package). It works as a sort of “gatekeeper” to the su binary. Applications which attempt to invoke su will be forced to route through Superuser, which will then prompt the user if it is an unknown or new application. The user then has the option of approving or denying the access to su and optionally having Superuser remember their decision so it can automatically apply it for subsequent calls by that app. By doing this, the only apps which are granted root permissions are ones that the user chooses.

The source of both applications is available on Github, and can be examined/audited by anyone who wishes to look at it (Superuser here, su here).

, ,

30
Apr

In every dual-core phone, there’s a PC

trying to get out.

Now multi-core Android phones can be PCs too. Ubuntu for Android enables high-end Android handsets to run Ubuntu, the world’s favourite free PC desktop operating system. So users get the Android they know on the move, but when they connect their phone to a monitor, mouse and keyboard, it becomes a PC.

Find More http://www.ubuntu.com/devices/android

30
Apr
find ! -iname "abc" -maxdepth 1 -depth -print0 | sed '$d' | xargs -0 rm -r; 

Notes:

  • -depth — reverses the output (so you dont delete sub-dirs first)
  • -maxdepth 1 — kind of voids the use of -depth, but this says only output contents of the current directory and not sub-dirs (which are removed by the -r option anyway)
  • -print0 and -0 — splits on line feeds instead of white space (for dirs with space in the name)
  • sed "$d" — says to remove the last line ( its now reversed). The last line is just a period which including would make the call delete everything in the directory (and subs!)

, , ,

30
Apr
private double[] getGPS() {
        LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);  
        List<String> providers = lm.getProviders(true);

        /* Loop over the array backwards, and if you get an accurate location, then break out the loop*/
        Location l = null;
       
        for (int i=providers.size()-1; i>=0; i--) {
                l = lm.getLastKnownLocation(providers.get(i));
                if (l != null) break;
        }
       
        double[] gps = new double[2];
        if (l != null) {
                gps[0] = l.getLatitude();
                gps[1] = l.getLongitude();
        }
        return gps;
}

30
Apr
ContentResolver cR = context.getContentResolver();
MimeTypeMap mime = MimeTypeMap.getSingleton();
String type = mime.getExtensionFromMimeType(cR.getType(uri));

30
Apr

Set the flag FLAG_KEEP_SCREEN_ON for your Activity. You can also use XML attribute android:keepScreenOn for different views.

//First method: TestActivity.java
public class TestActivity extends Activity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    UtilSystem.setKeepScreenOn(this, true);
  }

 
  public void setKeepScreenOn(Activity activity, boolean keepScreenOn) {
    if(keepScreenOn) {
      activity.getWindow().
        addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    } else {
      activity.getWindow().
        clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    }
  }
}

// Second method: main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android = "http://schemas.android.com/apk/res/android"
  android:keepScreenOn = "true"
  android:orientation = "vertical"
  android:layout_width = "fill_parent"
  android:layout_height = "fill_parent">
  <!-- ... -->
</LinearLayout>