AllInWorld99 provides a reference manual covering many aspects of web programming, including technologies such as HTML, XHTML, CSS, XML, JavaScript, PHP, ASP, SQL,FLASH, jQuery, java, for loop, switch case, if, if else, for...of, for...in, for...each,while loop, blogger tips, blogger meta tag generator, blogger tricks, blogger pagination, client side script, html code editor, javascript editor with instant output, css editor, online html editor, materialize css tutorial, materialize css dropdown list,break, continue statement, label,array, json, get day and month dropdown list using c# code, CSS button,protect cd or pendrive from virus, cordova, android example, html and css to make android app, html code play,telerik show hide column, Transparent image convertor, copy to clipboard using javascript without using any swf file, simple animation using css, SQL etc. AllInWorld99 presents thousands of code examples (accompanied with source code) which can be copied/downloaded independantly. By using the online editor provided,readers can edit the examples and execute the code experimentally.


     The following codova plugin is used to control the vibration in android mobile. This can be set the time of vibration and cancel the vibration.

     cordova plugin add cordova-plugin-vibration


Screen shot:
Create vibration in android smart phone using cordova




<!DOCTYPE html>
<html>
<head>

    <meta name="format-detection" content="telephone=no">
    <meta name="msapplication-tap-highlight" content="no">
    <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'" />
    <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
    <title>Vibration Test</title>
</head>
<body>
    <center>
        <input type="button" value="Vibrate 3 sec" onclick="vibr3();">
        <br>
        <input type="button" value="Vibrate 5 sec" onclick="vibr5();">
        <br>
        <input type="button" value="Vibrate 20 sec" onclick="vibr20();">
        <br>
        <input type="button" value="Stop & Start" onclick="stepvibr();">
        <br>

        <input type="button" value="Stop Vibration" onclick="stpvibr();">
        <br>
    </center>

    <script type="text/javascript" src="cordova.js"></script>
    <script>
        document.addEventListener("deviceready", onDeviceReady, false);

        function onDeviceReady() {
            console.log(navigator.vibrate);
        }

        function vibr3() {
            navigator.vibrate(3000); //3second
        }

        function vibr5() {
            navigator.vibrate(5000); //3second
        }

        function vibr20() {
            navigator.vibrate(20000); //20second
        }

        function stpvibr() {
            navigator.vibrate(0); //Stop Vibration
        }

        function stepvibr() {
            // Vibrate for 1 second
            // Wait for 1 second
            // Vibrate for 3 seconds
            // Wait for 1 second
            // Vibrate for 5 seconds
            navigator.vibrate([1000, 1000, 3000, 1000, 5000]);
        }
    </script>


</body>

</html>







0 comments:

Post a Comment

Total Pageviews