forked from github/cordova-android
Removing cruft before restarting the work on the new android API
This commit is contained in:
parent
2a38423855
commit
08691b73c2
@ -186,13 +186,8 @@ addLoadEvent(initGap);
|
|||||||
|
|
||||||
<ul id="home" title="Main" selected="true">
|
<ul id="home" title="Main" selected="true">
|
||||||
<li><a href="#system" onclick="updateSettings();return false;">System...</a></li>
|
<li><a href="#system" onclick="updateSettings();return false;">System...</a></li>
|
||||||
<li><a href="#geo" onclick="">Change Location...</a></li>
|
|
||||||
<li><a href="#readgeo" onclick="readLocation();">Read Location...</a></li>
|
<li><a href="#readgeo" onclick="readLocation();">Read Location...</a></li>
|
||||||
<li><a href="#setintervals" onclick="">Set user Intervals...</a></li>
|
|
||||||
<!-- <li><a href="#geo" onclick="updateLocation();">Geo-Location...</a></li> -->
|
|
||||||
<li><a href="#accel" onclick="updateAccel();">Accelerometer...</a></li>
|
<li><a href="#accel" onclick="updateAccel();">Accelerometer...</a></li>
|
||||||
<li><a href="#vibration" onclick="Device.vibrate();">Vibration</a></li>
|
|
||||||
<li><a href="#vibration" onclick="Device.playSound('on.mp3")">Play Sound</a></li>
|
|
||||||
<li><a href="#photo" onclick="Device.Image.getFromPhotoLibrary();">Photo...</a></li>
|
<li><a href="#photo" onclick="Device.Image.getFromPhotoLibrary();">Photo...</a></li>
|
||||||
<li><a href="#audio" onclick="audio();">Audio...</a></li>
|
<li><a href="#audio" onclick="audio();">Audio...</a></li>
|
||||||
<li><a href="#notification" onclick="notification();">Notification...</a></li>
|
<li><a href="#notification" onclick="notification();">Notification...</a></li>
|
||||||
|
@ -114,65 +114,6 @@ public class PhoneGap{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void playSound(final String filename)
|
|
||||||
{
|
|
||||||
MediaPlayer mp = new MediaPlayer();
|
|
||||||
|
|
||||||
try {
|
|
||||||
// MediaServer does not allow reading of urls out of app data folder
|
|
||||||
// thus we grab raw file and submit via file descriptor
|
|
||||||
// instead
|
|
||||||
// InputStream is = mCtx.getAssets().open(filename);
|
|
||||||
// work around cannot play audio streams
|
|
||||||
// to get around security restriction on MediaPlayer
|
|
||||||
// until Android sdk 1.1
|
|
||||||
// thus these changes and the playSound js
|
|
||||||
// needs moved to Dev.x so that we can if statement out
|
|
||||||
// via the sdk number
|
|
||||||
|
|
||||||
if(getSDKVersion() == "1")
|
|
||||||
{
|
|
||||||
// The hack way audio stored in R.raw.filename
|
|
||||||
// and we if statement check our way through
|
|
||||||
// to match the window.DroidGap.playSound(filename.mp3)
|
|
||||||
////call on the html side
|
|
||||||
|
|
||||||
int oursound;
|
|
||||||
|
|
||||||
if (filename == "bird.mp3") {
|
|
||||||
mp.create(mCtx, R.raw.bird);
|
|
||||||
|
|
||||||
}
|
|
||||||
if (filename == "on.mp3") {
|
|
||||||
mp.create(mCtx, R.raw.on);
|
|
||||||
}
|
|
||||||
if (filename == "off.mp3"){
|
|
||||||
mp.create(mCtx, R.raw.off);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(getSDKVersion() == "1.1")
|
|
||||||
{
|
|
||||||
//TODO: do right way here when Google fixes it
|
|
||||||
// as we have a security exception preventing
|
|
||||||
// playing audio file form file:///android_asset/ location
|
|
||||||
mp.setDataSource("file:///android_asset/" + filename);
|
|
||||||
mp.prepare();
|
|
||||||
mp.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
//mp.setDataSource("file:///android_asset/" + filename);
|
|
||||||
//mp.setDataSource("http://ventrix.nsdc.gr/stuff/TERMITES_SKONH.mp3");
|
|
||||||
mp.prepare();
|
|
||||||
mp.start();
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
//TO-DO: Load a Javascript Exception thrower
|
|
||||||
} catch (IllegalStateException e) {
|
|
||||||
//TO-DO: Load a Javascript Exception thrower
|
|
||||||
} catch (IOException e) {
|
|
||||||
//TO-DO: Load a Javascript Exception thrower
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public String outputText(){
|
public String outputText(){
|
||||||
String test = "<p>Test</p>";
|
String test = "<p>Test</p>";
|
||||||
|
Loading…
Reference in New Issue
Block a user