npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

com.rohngonnarock.ringtone

v0.1.4

Published

Ringtone ======

Downloads

8

Readme

com.rohngonnarock.ringtone v0.6.1

Ringtone

A Cordova / Phonegap ringtone plugin for Android. Set an audio file as ringtone, notification tone or alarm tone.

cordova plugin add https://github.com/rohngonnarock/cordova-plugin-ringtone

or

cordova plugin add com.rohngonnarock.ringtone

Methods

  • window.ringtone.setRingtone
  • window.ringtone.exportAssetAndSetRingtone

window.ringtone.setRingtone

Set a sound file as default Ringtone, notification tone or alarm tone

param {String}
    file The path to the audio file ("file:..." or "/android_asset/www/...")
param {String}
    title The title shown on the ringtone selection screen
param {String}
	artist The artist for the file, set to null or "" to use the name of the Application as artist
param {String}
    type The type of sound you want to set ["ringtone"|"notification"|"alarm"]
param {Function}
    successCallback The function to call when the heading data is available
param {Function}
    errorCallback The function to call when there is an error getting the heading data. (OPTIONAL)
    
window.ringtone.setRingtone(file, title, artist, type, successCallback, errorCallback)

window.ringtone.exportAssetAndSetRingtone

Copy an asset sound file to the sdcard or app directory and set it as Ringtone, notification tone or alarm tone *If you have a writable sdcard the new file is created in "sdcard/Ringtones/myFile.mp3" *If the sdcard is not writable or if it is missing, the new file is created inside the application folder "data/com.rohngonnarock.myApplication/ringtones/myFile.mp3"

param {String}
    file The path to the asset audio file ("/android_asset/www/...")
param {String}
    title The title shown on the ringtone selection screen
param {String}
	artist The artist for the exported file, set to null or "" to use the name of the Application as artist
param {String}
    type The type of sound you want to set ["ringtone"|"notification"|"alarm"]
param {Function}
    successCallback The function to call when the heading data is available
param {Function}
    errorCallback The function to call when there is an error getting the heading data. (OPTIONAL)
    
window.ringtone.exportAssetAndSetRingtone(file, title, artist, type, successCallback, errorCallback)

Supported Platforms

  • Android

Example 1

//Seting a sound file from the "www" folder as ringtone

window.ringtone.setRingtone("/android_asset/www/sounds/beep.wav",
    "Beep", null, "ringtone", 
    function(success) {
    	alert(success);
    },
    function(err) {
    	alert(err);
    })
		    

Example 2

//Seting a sound file from the SD card as notification tone

window.ringtone.setRingtone("file:///storage/sdcard/Android/data/com.rohngonnarock.myApplication/files/beep.mp3",
    "Beep", "Myself", "notification", 
    function(success) {
    	alert(success);
    },
    function(err) {
    	alert(err);
    })

Example 3

//Seting a sound file from the "www/sounds" folder as ringtone after copying it to another folder

window.ringtone.exportAssetAndSetRingtone("/android_asset/www/sounds/beep.wav",
    "Beep", "", "alarm", 
    function(success) {
    	alert(success);
    },
    function(err) {
    	alert(err);
    })

Permissions

android.permission.WRITE_SETTINGS

android.permission.READ_EXTERNAL_STORAGE

android.permission.WRITE_EXTERNAL_STORAGE

NOTE: Using sdk 23 or Android 6.0 global permission WRITE_SETTINGS is not allowed. There are two solutions:

  • Restrict sdk to 22 or lower
  • Use https://github.com/dpa99c/cordova-diagnostic-plugin to prompt app permission before using this plugin