update plugin and readme

This commit is contained in:
Roman
2013-09-26 15:46:49 +04:00
parent 2a9f6228d2
commit a820bdff45
2 changed files with 3 additions and 26 deletions

View File

@@ -4,9 +4,9 @@ cordova-plugin-startapp
Phonegap 3.0.0 plugin for launch other application in android device.
Install: ```cordova plugin add https://github.com/lampaa/startApp.git```
Install: ```cordova plugin add https://github.com/lampaa/org.apache.cordova.startapp.git```
Delete: ```cordova plugin rm org.apache.cordova.core.startapp```
Delete: ```cordova plugin rm org.apache.cordova.startapp```
use:
```js

View File

@@ -52,7 +52,6 @@ public class startApp extends CordovaPlugin {
*/
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
if (action.equals("startapp")) {
this.beep(1);
this.startApp(args.getString(0));
}
else {
@@ -70,30 +69,8 @@ public class startApp extends CordovaPlugin {
/**
* Beep plays the default notification ringtone.
*
* @param count Number of times to play notification
* startApp
*/
public void beep(long count) {
Uri ringtone = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Ringtone notification = RingtoneManager.getRingtone(this.cordova.getActivity().getBaseContext(), ringtone);
// If phone is not set to silent mode
if (notification != null) {
for (long i = 0; i < count; ++i) {
notification.play();
long timeout = 5000;
while (notification.isPlaying() && (timeout > 0)) {
timeout = timeout - 100;
try {
Thread.sleep(100);
} catch (InterruptedException e) {
}
}
}
}
}
public void startApp(String component) {
Intent LaunchIntent = this.cordova.getActivity().getPackageManager().getLaunchIntentForPackage(component);
this.cordova.getActivity().startActivity(LaunchIntent);