Back to project page Phonegap-3-Boilerplate.
The source code is released under:
GNU General Public License
If you think the Android project Phonegap-3-Boilerplate listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.apache.cordova.plugins; /* w ww. j a v a2 s . co m*/ import org.apache.cordova.CallbackContext; import org.apache.cordova.CordovaPlugin; import org.apache.cordova.PluginResult; import org.json.JSONArray; import android.content.Intent; import android.util.Log; public class HomeButton extends CordovaPlugin { public static final String LOG_PROV = "PhoneGapLog"; public static final String LOG_NAME = "HomeButton Plugin"; @Override public boolean execute(final String action, final JSONArray args, final CallbackContext callbackContext) { cordova.getThreadPool().execute(new Runnable() { @Override public void run() { Log.d(LOG_PROV, LOG_NAME + ": Simulated home button."); Intent i = new Intent(Intent.ACTION_MAIN); i.addCategory(Intent.CATEGORY_HOME); cordova.getActivity().startActivityForResult(i, 0); callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK)); } }); return true; } }