mercredi 23 avril 2014

Phonegap plugin is not working


Vote count:

0




I am building a simple plugin for android that prevent the Beep/Vibration when a touch event occurs but when I run android in the device I get Command failed with exit code 2.


I don't know much about Java but I'm following the example on this tutorial.


My plugin is very simple as I said, it's only prevent the Beep/Vibration when holding a touch event. So this is what I am doing:


plugin/src/android/sound.java



package org.apache.cordova.plugin;

import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CallbackContext;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;


public class SoundBeep extends CordovaPlugin {
AudioManager aManager=(AudioManager)getSystemService(AUDIO_SERVICE);
aManager.setRingerMode(aManager.RINGER_MODE_SILENT);
}

@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {

}


plugin/src/plugin.xml



<?xml version="1.0" encoding="UTF-8"?>

<plugin xmlns="http://ift.tt/1c8ZadK"
id="org.trollglodita.sounds"
version="0.1.0">
<name>sound</name>
<description>Sample PhoneGap Sound Plugin</description>
<license>RO</license>
<keywords>phonegap,sound</keywords>

<!-- android -->
<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
<feature name="sound">
<param name="android-package" value="org.trollglodita.sound.sound"/>
</feature>
</config-file>

<source-file src="src/android/sound.java" target-dir="src/sounds" />
</platform>
</plugin>


asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire