ringtone

External Storage Permission Issue with MediaProvider / Ring Tones

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 22:09:35
Some of my users have reported to Google Play the following error when trying to select a ringtone in my app. (there's more to it, but it's not relevant) java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/audio/media from pid=5738, uid=10122 requires android.permission.READ_EXTERNAL_STORAGE I assume this issue is happening due to certain tones that are on external storage. I don't want to include the READ_EXTERNAL_STORAGE permission in my app unless I absolutely have to. Is there a way to circumvent the issue and just

Pause Phone Ringtone while Speaking through Text To Speech and then Resume

末鹿安然 提交于 2019-11-30 15:45:20
问题 I am making a caller speaking application which speak caller name using TTS. I want to pause the ringtone while TTS is speaking then resuming the ringtone. From what i have researched we can use AudioFocus (hope so). Anyway i am using the following code Update I am using this code now. public void speak(final String talk) throws InterruptedException { final AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); int musicVolume= audioManager.getStreamVolume

Pause Phone Ringtone while Speaking through Text To Speech and then Resume

落爺英雄遲暮 提交于 2019-11-30 15:43:41
I am making a caller speaking application which speak caller name using TTS. I want to pause the ringtone while TTS is speaking then resuming the ringtone. From what i have researched we can use AudioFocus (hope so). Anyway i am using the following code Update I am using this code now. public void speak(final String talk) throws InterruptedException { final AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); int musicVolume= audioManager.getStreamVolume(AudioManager.STREAM_MUSIC); audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, musicVolume, 0);

Pick songs from SD card on Android and play it

﹥>﹥吖頭↗ 提交于 2019-11-29 23:29:04
问题 I have songs in the Music folder on the SD card. And in my app I want to pick a song from SD card from the list of music files, and when I choose any song, then using the Play button it should be played. How can I do that? I have already done it using content resolver and got a list of songs. Is there a way to do this using intents to pick from stored songs the SD card ? I have done this by both the ways. Just check it. 回答1: Check these to get an Idea, http://androidgenuine.com/?tag=play

Android ringtone set programmatically?

吃可爱长大的小学妹 提交于 2019-11-29 16:33:41
I want to implement set ringtone to my application after recording voice.Ringtone will set correctly only one time it will be set as ringtone while set again its not working properly here i have added my code: String filepath ="/sdcard/sample/"+currentName+""; System.out.println("/sdcard/sample/"+currentName+""); File ringtoneFile = new File(filepath); ContentValues content = new ContentValues(); content.put(MediaStore.MediaColumns.DATA,ringtoneFile.getAbsolutePath()); content.put(MediaStore.MediaColumns.TITLE, currentName); content.put(MediaStore.MediaColumns.SIZE, 215454); content.put

i want get audio files in sd card

感情迁移 提交于 2019-11-29 12:42:33
In my app I want to set the ringtone when I get an incoming call... How to open the SDCARD and get audio files and list it.. How to get the URI for the selected audio file .. MediaScanner finds music for you, populating the MediaStore database. Here's some code to look up a music entry: final Uri uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; final String[] cursor_cols = { MediaStore.Audio.Media._ID, MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media.ALBUM, MediaStore.Audio.Media.TITLE, }; final String where = MediaStore.Audio.Media.IS_MUSIC + "=1"; final Cursor cursor =

How to programmatically silence the ringer or change the ringer tone on iOS5

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 07:28:09
Is there a way to reduce the volume of the ringer or change the ringer tone on iOS5? I checked out the Celestial framework, but can't instantiate AVSystemController. :-( I don't care if this get's the app rejected in the AppStore as it will never be submitted. Yes. Use AVSystemController . You don't instantiate it. It's a singleton. http://code.google.com/p/iphone-dev/source/browse/trunk/include/include/Celestial/AVSystemController.h?r=136 [[AVSystemController sharedAVSystemController] setVolumeTo:10.0 forCategory:@"Ringtone"]; JoeCortopassi This might be what you are looking for: Override

Incoming call dynamically override default ringtone

烂漫一生 提交于 2019-11-28 18:54:34
My app allows you to specify a different ringtone for different incoming events. EG: incoming call, incoming SMS, etc. What I am trying to accomplish is when I receive for example an incoming call, I check my apps database if a specific option is selected and if there is a ringtone option set play that ringtone. However the problem I am having is I am unable to override / stop the default phone ringtone from playing. I have tried several different ways, but from the docs most of those methods only stop the current instance and are not global methods. I can't set the ringtone in the default

Android ringtone set programmatically?

不羁的心 提交于 2019-11-28 11:21:57
问题 I want to implement set ringtone to my application after recording voice.Ringtone will set correctly only one time it will be set as ringtone while set again its not working properly here i have added my code: String filepath ="/sdcard/sample/"+currentName+""; System.out.println("/sdcard/sample/"+currentName+""); File ringtoneFile = new File(filepath); ContentValues content = new ContentValues(); content.put(MediaStore.MediaColumns.DATA,ringtoneFile.getAbsolutePath()); content.put(MediaStore

i want get audio files in sd card

前提是你 提交于 2019-11-28 06:10:51
问题 In my app I want to set the ringtone when I get an incoming call... How to open the SDCARD and get audio files and list it.. How to get the URI for the selected audio file .. 回答1: MediaScanner finds music for you, populating the MediaStore database. Here's some code to look up a music entry: final Uri uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; final String[] cursor_cols = { MediaStore.Audio.Media._ID, MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media.ALBUM, MediaStore.Audio.Media