Exemple #1
0
     $result = $droid->dialogGetResponse();
     switch ($result['result']->which) {
         case "negative":
             $action = "bye";
             break;
         case "positive":
         default:
             $action = "start";
             break;
     }
     $droid->dialogDismiss();
     break;
 case "choose_and_ask":
     $droid->dialogCreateAlert("Choose your sign:");
     $zodiac = array("aries", "taurus", "gemini", "cancer", "leo", "virgo", "libra", "scorpio", "sagittarius", "capricorn", "aquarius", "pisces");
     $droid->dialogSetItems($zodiac);
     $droid->dialogShow();
     $result = $droid->dialogGetResponse();
     $url = "http://widgets.fabulously40.com/horoscope.json?sign=" . $zodiac[$result['result']->item];
     // Downloading the horoscope might take a while...
     $droid->dialogCreateSpinnerProgress("Retrieving information...", "Please wait");
     $droid->dialogShow();
     // Downloading and de-json-ing
     $result = json_decode(file_get_contents($url));
     // we are ready!
     $droid->vibrate();
     // Close spinner
     $droid->dialogDismiss();
     $theFuture = html_entity_decode($result->horoscope->horoscope, ENT_QUOTES, "UTF-8");
     // Something is wrong with '...
     $theFuture = str_replace("'", "'", $theFuture);
Exemple #2
0
<?php

require_once "Android.php";
$object = new Android();
$object->dialogCreateAlert("Quiz Game By", "Amit Kumar Mondal");
$object->dialogSetPositiveButtonText("Proceed");
$object->dialogSetNegativeButtonText("Exit");
$object->dialogShow();
$response = $object->dialogGetResponse();
$function = $response["result"]->which == "positive" ? "proceed" : "exit";
switch ($function) {
    case "proceed":
        $object->dialogCreateAlert("What is Codename for MAC OS X 10.7?");
        $ans11 = array("Lion", "Leopard", "Snow Leopard", "Tiger");
        $object->dialogSetItems($ans11);
        $object->dialogShow();
        $ans1 = $object->dialogGetResponse();
        $ans1m = "Lion";
        if ($ans11[$ans1["result"]->item] == $ans1m) {
            $object->dialogCreateAlert("Result", "Right Answer");
            $object->dialogSetPositiveButtonText("Next");
            $object->dialogShow();
            $next = $object->dialogGetResponse();
            if ($next["result"]->which == "positive") {
                $object->dialogCreateAlert("What is the new Database developed by Google?");
                $ans22 = array("NoSQL", "MongoDB", "F1", "CouchDB");
                $object->dialogSetItems($ans22);
                $object->dialogShow();
                $ans2 = $object->dialogGetResponse();
                $ans2m = "F1";
                if ($ans22[$ans2["result"]->item] == $ans2m) {
Exemple #3
0
<?php

include "Android.php";
$droid = new Android();
//creates alert
$droid->dialogCreateAlert();
$result = array();
//gets coordinates
$latitude = $droid->dialogGetInput("Location", "Latitude: ");
$longitude = $droid->dialogGetInput("Location", "Longitude: ");
//gets the location info
$locations = $droid->dialogGeocode($latitude['result'], $longitude['result']);
//parses location info
foreach ($locations['result'] as $location) {
    $location = get_object_vars($location);
    //sets location items
    foreach ($location as $key => $value) {
        $result[] = ucfirst(str_replace('_', ' ', $key)) . ': ' . $value;
    }
}
$droid->dialogSetItems($result);
//displays the box
$droid->dialogShow();