startActivity

Data de postagem: 26/06/2012 00:54:10

startActivity(

String action,

String uri[optional],

String type[optional]: MIME type/subtype of the URI,

JSONObject extras[optional]: a Map of extras to add to the Intent,

Boolean wait[optional]: block until the user exits the started activity,

String packagename[optional]: name of package. If used, requires classname to

be useful,

String classname[optional]: name of class. If used, requires packagename to be

useful)

Starts an activity.

Exemplo:

This launch the set wallpaper app.

<?php

require_once("Android.php");

$droid = new Android();

$droid->startActivity("android.intent.action.SET_WALLPAPER");

$droid->exit();

?>

----------

And this get the power usage summary app.

<?php

require_once("Android.php");

$droid = new Android();

$droid-

>startActivity("android.intent.action.POWER_USAGE_SUMMARY");

$droid->exit();

?>

---------------

print_r($droid->startActivity("android.intent.action.VIEW","tel:"));

print_r($droid->startActivity("android.intent.action.VIEW","tel:123"));

print_r($droid->sendEmail('',"assunto","teste"));

print_r($droid->startActivity("android.intent.action.VIEW","sms:"));

print_r($droid->startActivity("android.intent.action.VIEW","sms:123"));

print_r($droid->startActivity("android.intent.action.VIEW","smsto:123"));

$arr = array("sms_body" => "teste");

print_r($droid->startActivityForResult("android.intent.action.VIEW",null,"vnd.android-dir/mms-sms",$arr));

print_r($droid->startActivity("android.intent.action.VIEW",NULL,"vnd.android-dir/mms-sms",$arr));

print_r($droid->startActivity("android.intent.action.VIEW","mailto:"));

print_r($droid->startActivity("android.intent.action.VIEW","mailto:silviogarbes@gmail.com"));

print_r($droid->startActivity("android.intent.action.INSERT","content://contacts/people"));

-----------

$html = "<html><body>

<h1>Battery Status</h1>

<ul>

<li><strong>Status: s</li>

<li><strong>Temperature: s</li>

<li><strong>Level: s</li>

<li><strong>Plugged In: s</li>

</ul>

</body></html>";

$arquivo = '/sdcard/sl4a/scripts/battstats.html';

$fp = fopen($arquivo, 'w');

fwrite($fp, $html);

fclose($fp);

$droid->startActivity("android.intent.action.VIEW", "file:///sdcard/sl4a/scripts/battstats.html", "text/html");

-----------------

-----------------