Dynamic Ringtone - not switching

Post your questions and help other users.

Moderator: Martin

jarid
Posts: 21
Joined: 10 Aug 2015 06:45

Re: Dynamic Ringtone - not switching

Post by jarid » 22 Aug 2015 19:03

Oops. Getting an error message on my notification bar. Error: Could not play sound: null.

Here is the log from the last call.

22.08.2015 11:47:05.357 [Phone Call] Starting to execute flow 'Phone Call' with Context{global{global_volume_music=15,global_volume_dtmf=15,global_volume_notification=7,global_volume_alarm=7,global_volume_system=7,global_volume_ring=7,global_volume_voice_call=6},local{trigger=Incoming Call. State: Ringing, Numbers: All,contact_email=XXXXXXflow_name=Phone Call,call_state=RINGING,contact_title=,contact_note=Category: Friends,contact_company=,incoming_number=XXXXXX,contact_nickname=,call_missed_rejected=false,contact_name=XXXXXX,triggertime=1440269224969,contact_groups=[My Contacts, Starred in Android, Friends]}}
22.08.2015 11:47:05.362 [Phone Call] Start executing condition 'Expression: containsElement(contact_groups,"Starred in Android")'
22.08.2015 11:47:05.401 [Phone Call] End executing condition 'Expression: containsElement(contact_groups,"Starred in Android")' with return value true
22.08.2015 11:47:05.413 [Phone Call] Flow continues executing with the next step.
22.08.2015 11:47:05.415 [Phone Call] Start executing action 'Script: playring = "/system/media/audio/ringtones/Eastern_Sky.ogg"'
22.08.2015 11:47:05.453 [Phone Call] End executing action 'Script: playring = "/system/media/audio/ringtones/Eastern_Sky.ogg"'
22.08.2015 11:47:05.454 [Phone Call] Flow continues executing with the next step.
22.08.2015 11:47:05.455 [Phone Call] Start executing condition 'Wired Headset Plugged'
22.08.2015 11:47:05.456 [Phone Call] End executing condition 'Wired Headset Plugged' with return value false
22.08.2015 11:47:05.457 [Phone Call] Flow continues executing with the next step.
22.08.2015 11:47:05.458 [Phone Call] Start executing condition 'Bluetooth Device Connected: Jawbone ICON'
22.08.2015 11:47:05.470 [Phone Call] End executing condition 'Bluetooth Device Connected: Jawbone ICON' with return value false
22.08.2015 11:47:05.472 [Phone Call] Flow continues executing with the next step.
22.08.2015 11:47:05.472 [Phone Call] Start executing action 'Script: raisevol = "true"'
22.08.2015 11:47:05.487 [Phone Call] End executing action 'Script: raisevol = "true"'
22.08.2015 11:47:05.488 [Phone Call] Flow continues executing with the next step.
22.08.2015 11:47:05.489 [Phone Call] Start executing action 'Store Music Volumes'
22.08.2015 11:47:05.523 [Phone Call] Action 'Store Music Volumes' Set global_volume_music to 15
22.08.2015 11:47:05.524 [Phone Call] End executing action 'Store Music Volumes'
22.08.2015 11:47:05.525 [Phone Call] Flow continues executing with the next step.
22.08.2015 11:47:05.526 [Phone Call] Start executing condition 'Expression: raisevol = "true"'
22.08.2015 11:47:05.553 [Phone Call] End executing condition 'Expression: raisevol = "true"' with return value true
22.08.2015 11:47:05.556 [Phone Call] Flow continues executing with the next step.
22.08.2015 11:47:05.557 [Phone Call] Start executing action 'Set Audio Stream Volume: Music to level 15'
22.08.2015 11:47:05.781 [Phone Call] End executing action 'Set Audio Stream Volume: Music to level 15'
22.08.2015 11:47:05.946 [Phone Call] Flow continues executing with the next step.
22.08.2015 11:47:05.947 [Phone Call] Start executing action 'Sound: {playring} as Ring'
22.08.2015 11:47:05.950 [Phone Call] End executing action 'Sound: {playring} as Ring'
22.08.2015 11:47:05.997 [Phone Call] Flow continues executing with the next step.
22.08.2015 11:47:06.000 [Phone Call] Start executing condition 'Call State: Ringing'
22.08.2015 11:47:06.012 [Phone Call] End executing condition 'Call State: Ringing' with return value true
22.08.2015 11:47:06.019 [Phone Call] Flow continues executing with the next step.
22.08.2015 11:47:06.021 [Phone Call] Start executing action 'Sleep: 4s (keep device awake)'
22.08.2015 11:47:06.023 [Phone Call] Action 'Sleep: 4s (keep device awake)' Sleeping for 4s (keep device awake)
22.08.2015 11:47:10.168 [Phone Call] End executing action 'Sleep: 4s (keep device awake)'
22.08.2015 11:47:10.169 [Phone Call] Flow continues executing with the next step.
22.08.2015 11:47:10.170 [Phone Call] Start executing action 'Sound: {playring} as Ring'
22.08.2015 11:47:10.185 [Phone Call] End executing action 'Sound: {playring} as Ring'
22.08.2015 11:47:10.186 [Phone Call] Flow continues executing with the next step.
22.08.2015 11:47:10.189 [Phone Call] Start executing condition 'Call State: Ringing'
22.08.2015 11:47:10.191 [Phone Call] End executing condition 'Call State: Ringing' with return value true
22.08.2015 11:47:10.193 [Phone Call] Flow continues executing with the next step.
22.08.2015 11:47:10.194 [Phone Call] Start executing action 'Sleep: 4s (keep device awake)'
22.08.2015 11:47:10.196 [Phone Call] Action 'Sleep: 4s (keep device awake)' Sleeping for 4s (keep device awake)
22.08.2015 11:47:14.221 [Phone Call] End executing action 'Sleep: 4s (keep device awake)'
22.08.2015 11:47:14.225 [Phone Call] Flow continues executing with the next step.
22.08.2015 11:47:14.227 [Phone Call] Start executing action 'Sound: {playring} as Ring'
22.08.2015 11:47:14.231 [Phone Call] End executing action 'Sound: {playring} as Ring'
22.08.2015 11:47:14.235 [Phone Call] Flow continues executing with the next step.
22.08.2015 11:47:14.240 [Phone Call] Start executing condition 'Call State: Ringing'
22.08.2015 11:47:14.246 [Phone Call] End executing condition 'Call State: Ringing' with return value false
22.08.2015 11:47:14.249 [Phone Call] Flow continues executing with the next step.
22.08.2015 11:47:14.251 [Phone Call] Start executing action 'Stop Action Sound'
22.08.2015 11:47:14.259 [Phone Call] End executing action 'Stop Action Sound'
22.08.2015 11:47:14.264 [Phone Call] Flow continues executing with the next step.
22.08.2015 11:47:14.273 [Phone Call] Start executing condition 'Expression: raisevol = "true"'
22.08.2015 11:47:14.286 [Phone Call] End executing condition 'Expression: raisevol = "true"' with return value true
22.08.2015 11:47:14.292 [Phone Call] Flow continues executing with the next step.
22.08.2015 11:47:14.293 [Phone Call] Start executing action 'Restore Music Volumes'
22.08.2015 11:47:14.297 [Phone Call] Action 'Restore Music Volumes' Set volume using global_volume_music to 15
22.08.2015 11:47:14.299 [Phone Call] End executing action 'Restore Music Volumes'
22.08.2015 11:47:14.300 [Phone Call] Flow ended.
22.08.2015 11:47:14.334 [Phone Call] Action 'Sound: {playring} as Ring'
java.lang.IllegalStateException
at android.media.MediaPlayer.setAudioStreamType(Native Method)
at ch.gridvision.ppam.androidautomagic.d.a.gq$1.a(SourceFile:515)
at ch.gridvision.ppam.androidautomagic.util.he$1.run(SourceFile:39)
at java.lang.Thread.run(Thread.java:841)

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Re: Dynamic Ringtone - not switching

Post by MURTUMA » 22 Aug 2015 20:42

The flow seems to run to the end without problems, the error comes up at the last line in the log. My knowledge stops here, you'll have to wait for Martin to solve this.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Dynamic Ringtone - not switching

Post by Martin » 23 Aug 2015 09:15

Hi Jarid

I'm puzzled by the exception since it does not really give much details about the real issue. Are you using an old version of Automagic? If yes, could you please update to the latest version available on Google Play and test again? There have been some internal changes to action Sound so the exception might not be the same anymore. Please also try to restart the device once.

Regards,
Martin

jarid
Posts: 21
Joined: 10 Aug 2015 06:45

Re: Dynamic Ringtone - not switching

Post by jarid » 23 Aug 2015 15:33

I am using a Droid Razr Maxx (XT912) running CyanogenMod v11-201560626-SNAPSHOT-XNG3CAO1L8-spyder on Android v4.4.4.

Automagic v1.28.0

I have a flow that reboots the device every night.

Manually rebooted the device this morning. Incoming call...after hanging-up, had the same error message.

I clear the error message after each occurrence. It does NOT happen with each call.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Dynamic Ringtone - not switching

Post by Martin » 24 Aug 2015 19:13

That's strange, maybe it's a timing related issue when the phone app and Automagic try to start the playback exactly at the same time. Please try to add an action Sleep: 5s right before the action Sound and see if this helps. Also try to change the duration from 5s to 2s or up to 10s to see if this makes a difference.

When the flow starts to fail, does the flow work again sometimes or does it fail every time when it fails once?

jarid
Posts: 21
Joined: 10 Aug 2015 06:45

Re: Dynamic Ringtone - not switching

Post by jarid » 28 Aug 2015 20:12

I finished my testing....

As per your instructions, I made the adjustments and tried different timing combinations...error still occurred. Even with the error in the notification, the flow responded to the next incoming call.

Additional problems: 1) adjusting the time delayed the sound/music did not give me enough rings to answer the phone (since it is initially set to silent), 2) sometimes when I answer the phone, the song continues to play until the end of the ringtone and 3) sometimes at the completion of the song, the ringtone will resume from where it stopped.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Dynamic Ringtone - not switching

Post by Martin » 30 Aug 2015 10:52

Could you please share the flow so I can make some tests with the exact same flow? You can also send it to info@automagic4android.com if you prefer not to share it in the forum.

jarid
Posts: 21
Joined: 10 Aug 2015 06:45

Re: Dynamic Ringtone - not switching

Post by jarid » 30 Aug 2015 15:57

2015-08-30 15.38.56.png
2015-08-30 15.38.56.png (96.18 KiB) Viewed 17987 times
flow_Phone_Call_20150830_151506.xml
(12.37 KiB) Downloaded 1038 times

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Dynamic Ringtone - not switching

Post by Martin » 09 Sep 2015 19:28

After all I've found the cause of the error: Immediately executing an action Stop Sound after starting a sound sometimes leads to the error since action Sound does not have enough time to properly start playback. You can workaround this issue by adding an action Sleep: 2s before executing the stop action at the end of the flow.
The actions should be fixed in the next version.

Regards,
Martin

jarid
Posts: 21
Joined: 10 Aug 2015 06:45

Re: Dynamic Ringtone - not switching

Post by jarid » 11 Sep 2015 19:18

I will have to wait for the update. Adding the delay will permit the song to continue playing when I answer the phone (the other side can hear the music).

Post Reply