Showing posts with label google. Show all posts
Showing posts with label google. Show all posts

Wednesday, September 7, 2011

Google Weather API Widget (PHP) (No longer Working)




Note: Google has killed the free hidden weather API so this method no longer works

The Google Weather API is a hidden service for developers to get weather data for any location with ease.
Indeed, you just simply pass a city name or postal code, such as this Mountain View

Query by City
http://www.google.com/ig/api?weather=Mountain+View   

Query by Coordinates
http://www.google.com/ig/api?weather=,,,30670000,104019996 

To get an XML response like this:


This is the php code to get a widget like shown above. Line 20 defines the location for the widget.
Either you can use postal code, city or coordinates multiplied by 1000000 (Check Line No 21,22,23,25)

1:  <?php  
2:  function convert($temp)  
3:  {  
4:    // Converting Fahrenheit To Celsius, vice versa  
5:    global $config;  
6:    $temperature = $temp;  
7:    if( strtoupper($config['base-temp-unit']) == 'F' && strtoupper($config['display-temp-unit']) == 'C' )  
8:    {  
9:      // Converting Fahrenheit To Celsius  
10:      $temperature = round((5/9)*($temp-32));  
11:    }  
12:    if( strtoupper($config['base-temp-unit']) == 'C' && strtoupper($config['display-temp-unit']) == 'F' )  
13:    {  
14:      // Converting Celsius to Fahrenheit  
15:      $temperature = round((9/5)*$temp+32);  
16:    }  
17:    return $temperature;  
18:  }  
19:  $url = "http://www.google.com";  
20:  $location = "colombo"; // <city>,<country code>  
21:  $lat;  
22:  $lng;  
23:  //$location = ",,,30670000,104019996"; // Coordinates
24:  $weather_url = "{$url}/ig/api?weather={$location}";  
25:  //$weather_url = "{$url}/ig/api?weather=,,,{$lat},{$lng}";  
26:  $config['base-temp-unit'] = 'F'; // F=Fahrenheit, C=Celsius  
27:  $config['display-temp-unit'] = 'C'; // F=Fahrenheit, C=Celsius  
28:  if( $xmlData = file_get_contents($weather_url) )  
29:  {  
30:    $xml = new SimpleXMLElement($xmlData);  
31:    $eol = "\r\n";  
32:    // Display basic information  
33:       echo("<table width='70%' border='0' cellspacing='0' cellpadding='5'>");  
34:       echo("<tr>");  
35:       echo("<td width='11%' rowspan='4' align='center' valign='middle'>");  
36:       echo("<img src='{$url}{$xml->weather->current_conditions->icon->attributes()}' alt='' width='60' height='60' border='0' style='margin-right: 3px; vertical-align: top;>'");  
37:       echo("</td>");  
38:       echo("<td width='33%' align='left' valign='top'>{$xml->weather->current_conditions->temp_c->attributes()} C</td>");  
39:       echo("<td width='56%' rowspan='4' align='left' valign='top'><table width='100%' border='0' cellspacing='0' cellpadding='5' style='border-left:1px solid #CCCCCC'>");  
40:       echo("<tr>");  
41:       foreach( $xml->weather->forecast_conditions as $i => $result )  
42:    {  
43:       echo("<td align='center'>{$result->day_of_week->attributes()}</td>");  
44:       }  
45:       echo("</tr><tr>");  
46:       foreach( $xml->weather->forecast_conditions as $i => $result )  
47:    {  
48:       echo("<td align='center'><img src='{$url}{$result->icon->attributes()}'></td>");  
49:       }  
50:       echo("</tr><tr>");  
51:       foreach( $xml->weather->forecast_conditions as $i => $result )  
52:    {  
53:       echo("<td align='center'><table width='100%' border='0' cellspacing='0' cellpadding='5'><tr><td align='center'>".convert($result->high->attributes())." ".strtoupper($config['display-temp-unit'])."</td><td align='center'>".convert($result->low->attributes())." ".strtoupper($config['display-temp-unit'])."</td></tr></table></td>");  
54:       }  
55:       echo("</tr></table></td></tr><tr>");  
56:       echo("<td>{$xml->weather->current_conditions->condition->attributes()}</td>");  
57:       echo("</tr><tr>");  
58:       echo("<td>{$xml->weather->current_conditions->wind_condition->attributes()}</td>");  
59:       echo("</tr><tr>");  
60:       echo("<td>{$xml->weather->current_conditions->humidity->attributes()}</td>");  
61:       echo("</tr></table>");  
62:  }  
63:  ?>  

Wednesday, July 13, 2011

Download Android New Market V3.0.26 (Movies,Books, Multiple Account Support

The new Android Market has started rolling out to some user. If you haven't received it. Download here and install it using File managers

Please note that movies cannot be played on rooted devices, just as before.


Thursday, June 9, 2011

Guide on Getting Google Music outside United States


This is how i got my Google Music Beta Invitation. Took me less than and 5 minutes to configure it.Before everything you need an Android phone( Requires a rooted phone) to do this,. and all thank goes to Paul O Brian for the great guide he provided.



Step 1 - Requesting for an invitation
Go to http://music.google.com/about/ via a US proxy and request for an initation. I used http://www.hidemyass.com/

Step 2 - Get the New Google Music Android App 3.0.1

Check market for the New Google Music Beta App. If its not there, Use Market Enabler to fake the provide to some US provider(probably T- Mobile US) and recheck the market. Also you can manually download the apk and install It.

Step 3 - Last and the Hardest Part

You have to edit your phones build properties to get it quickly. Click Here
Copy the system/build.prop file to your computer and edit the build prop to match the one above in the link. Make sure to take a backup of your build.prob before editing. I used Root Explorer to replace the file. And Restart the phone, and keep in online (connected with the internet for 1 hour). Also go to the Downloaded Music Beta App, Visit Market app etc to make Google think that you are using a Motorola Xoom (Google exclusively rolls out invitation for Motorola Xoom Users). Thats It, after about one hour replace you build.prop with the original one.

Viola Thats It. Wait for the invitation. I got mine in one hour.

Google Music Beta Rolls Out in Europe




As you all know Google started the Google Cloud service in 2011's Google IO Event. Now Europeans have started to receive Google Music Beta invitations.

Source: Link

If you are not from US or Europe and wanted to try out the Music Beta Follow this guide.

Sunday, April 3, 2011

How To Publish App Inventor Applications In The Android Market


Publish the app created with App Inventor in the Android Market

What you need:

  • 1.6 Java Development Kit and Runtime Environment 1.6 already installed on your PC
  • Android SDK already installed and running
  • Appinventor Extras
  • APKTool
  • Auto-Sign 6.5

1) Creating the key

This procedure is a one-off and we don't need to do those steps every time.

So, thanks to the JAVA SDK we will create a private key, which will be used for publishing our applications

From the Bin folder of the Java SDK we'll execute in a terminal:
1:  keytool.exe -genkey -v -keystore my-release-key.keystore -alias aliasname -keyalg RSA -keysize 2048 -validity 10000  

The Market requires that applications need to publish the private key has a duration subsequent to October 22, 2033, so we'll use a validity of 10000 days (over 27 years!).

2) Customize the Icon of the application

Download the APK file on a local folder on your computer.

We'll use AutoSigner for those steps: (thanks to Marcor Online info@marcoronline.tk for this part).

Open the apk file with 7zip.

Delete META-INF folder (which is the folder where the application contains the certificates, no longer valid after the change).

The images are generally stored in the folder res\drawable, and in particular the icon of the program is called ya.png. Extract all the images you want with your favorite software (we use 7zip).

Be careful not to change the size in pixels and not to change the name and extension.

Once you have completed the changes you go to put the files again into the apk (using 7zip) by simply dragging and overwriting the original.

Close 7zip and rename your program Launcher.apk.

Extract the contents of the Auto-Sign v0.65.exe and copy the Launcher.apk file inside the folder Auto-Sign\update\app.


Run the tool by the Auto-Sign v0.65.exe executable and iselect from the drop down menĂ¹ Launcher.apk. (The name should been green. If not, you've made something wrong.)

Now click on Autosign and in a few seconds you'll get a confirmation message.

Inside the folder Auto-Sign\update\app will be a Launcher_signed.apk. You can delete the old file and keep only the signed one.

3) Edit the APK to be compatible with the Market

Decompile our apk

1:  apktool -s pre-nomeapk.apk  

in the just created folder called pre-nomeapk, go editing the AndroidManifest.xml file.

First we add the version of the application by adding the keyword "android: versionCode" and "android: versionName" in the keyword "package", just like this example:

 <? xml version = "1.0" encoding = "UTF-8"?>  
 <manifest xmlns: android = "http://schemas.android.com/apk/res/android" package = "appinventor.xyz.xyz" android:versionCode = "1" android:versionName = "1.0">  

Specify the minimum version of Android is needed to run the application. Beware that the Market has a bug at the moment, and does not support applications compiled for Froyo android 2.2. Consider the following table:

 API Level -> Android Platform Version  
 1 -> 1.0  
 2 -> 1.1  
 3 -> 1.5  
 4 -> 1.6  
 5 -> 2.0  
 6 -> 2.0.1  
 7 -> 2.1  
 8 -> 2.2  

If your application needs Eclair we enter the following keyword:

 <uses-sdk android:minSdkVersion="7" />  

Finally fix the last things needed to make compatible the apk to the Market
Remove the android:icon keyworld on this line:

 <activity android:label="123" android:icon="@drawable/ya" android:name=".Screen1">  

and add it in this line:
<application android:label="XXXXX" android:debuggable="true">
Also on the line relative to the "application", remove the key "android_: debuggable"

In the end the AndroidManifest.xml will result like this:

 <? xml version = "1.0" encoding = "UTF-8"?>  
 <manifest xmlns: android =  
 "http://schemas.android.com/apk/res/android"  
 package = "appinventor.xyz.xyz"  
 android:versionCode = "1"  
 android:versionName = "1.0">  
 <uses-sdk android:minSdkVersion="3" />  
 ......  
 <application android:label="XXXX" android:icon="@drawable/ya">  
 <activity android:label="123" android:name=".Screen1">  
 ....  
 </activity>  
 </application>  
 </manifest>  

Now compile the apk again:

 apktool b pre-nomeapk  

With 7zip open the apk and remove the file in the META-INF folder like:

 ANDROIDK.SF  
 ANDROIDK.RSA  

Source: Link