Android Question Default notification sound playing on startup

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Sam's Club had a Galaxy Tab A (SM-T280) (Running 5.1.1) on sale for under a $100 bucks so I brought it to have another screen size to test on.

When I start my Music App on it I hear the Default Notification sound being played as the app starts.

I'm not directly playing it and I do not hear it Play on a Samsung Galaxy Tab 10" or Any of my phones (S3, S5, S7)

How can I locate what is causing it to play so I can stop it.

It's not that bad only plays once on every startup. Just don't understand why / how and only this device?

BobVal
 

DonManfred

Expert
Licensed User
Longtime User
How could we help if you just give us NOT A SINGLE Info about your code.

Upload a project which shows the issue.
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Gee Don, I guess you don't think I would do that if I knew where the issue was happening (or why it was happening) I would.

This is a big app a lot of code here, not sure even where to look

I guess what I am looking for is what would cause my app to trigger a notification on Android 5.1.1 that doesn't appear happen in other Android versions

To my knowledge I am not doing anything (directly or indirectly) to trigger a notification and I know the default sound notification is being triggered because if I change the default sound it plays a new sound.

Wondering if any my permissions generate a default notification
B4X:
AddPermission(android.permission.ACCESS_NETWORK_STATE)
AddPermission(android.permission.ACCESS_WIFI_STATE)

AddPermission(android.permission.BROADCAST_STICKY)

AddPermission(android.permission.CALL_PHONE)
AddPermission(android.permission.CONNECTIVITY_INTERNAL)
AddPermission(android.permission.GET_ACCOUNTS)

AddPermission(android.permission.INTERACT_ACROSS_USERS_FULL)
AddPermission(android.permission.INTERNET)

AddPermission(android.permission.MEDIA_CONTENT_CONTROL)
AddPermission(android.permission.MODIFY_AUDIO_SETTINGS)
AddPermission(android.permission.MODIFY_PHONE_STATE)

AddPermission(android.permission.PERSONAL_MEDIA)
AddPermission(android.permission.PREVENT_POWER_KEY)

AddPermission(android.permission.READ_CONTACTS)
AddPermission(android.permission.READ_EXTERNAL_STORAGE)
AddPermission(android.permission.READ_PHONE_STATE)

AddPermission(android.permission.VIBRATE)

AddPermission(android.permission.WAKE_LOCK)
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddPermission(android.permission.WRITE_SETTINGS)

AddPermission(android.permission_group.AUDIO_SETTINGS)
 
Upvote 0

ac9ts

Active Member
Licensed User
Longtime User
Possibly part of the notification routine? I believe there was a change in how notifications are handled between 5.1.1 and 6.0 but I don't remember the specifics. Since you mentioned it only happens on start-up and only on the older O.S., I'd check your notification code.
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
That is what has me so puzzled. I don't do anything with notifications.

How would I check the notification code and where / when would I do this?
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
Is there a background service running in the app? Perhaps there is a notification being generated by the OS to let the user know?

- Colin.
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Actually a few

Starter
Background (one I use to do background tasks)
BlackBoxPlayer (does all the actually playing of music)
IPControl (talks to other devices over the network - My Amp, my phone, etc)
MyMediaBrowserService (handles METADATA to car when Bluetooth streaming and commands from Car - Play/Pause Skip/Previous)
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
Actually a few

Starter
Background (one I use to do background tasks)
BlackBoxPlayer (does all the actually playing of music)
IPControl (talks to other devices over the network - My Amp, my phone, etc)
MyMediaBrowserService (handles METADATA to car when Bluetooth streaming and commands from Car - Play/Pause Skip/Previous)
Are you getting an actual notification, or just the sound?

- Colin.
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Just tried some other apps of mine one that just has the basic Starter service (does not make sound on startup) and another that has 2 other services (3 including Starter) and it plays the same notify tune when starting.

Well at least this is somewhere to start. Will eliminate the services and see what happens.

THANKS so much for the push in (what I believe is) the right direction
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Colin - Good question - it is the sound of the default notification but I don't handle notifications in my program

Computersmit64 - YOU were right it was the starting of Services. If I don't start my services the program starts without a sound.
Do the StartService in starter and I heard the default notification sound.

In this program the background service is talking to my AMP over the network

NOW I know (well kind of know) what is causing the default notification to play.

How can I stop it and why is it only happening in this version of Android 5.1.1

DID find another something strange (now this program works on all my other devices no problem) but under this version of Android I am getting a stream error

Saw a post where this happened and Erel told someone it wasn't are real error so for right now I am ignoring it.

But again this only happens under 5.1.1

NOT sure if it good or bad that I added this device/OS to my collection

B4X:
           '----------------------------------------------------------------------------------
           '  FOR some reason I have not figured out why yet in Android version 5.1.1
           '       I get this stream error which causes me to think the connection has been
           '       lost and it really isn't.  So for the right now I ignore it.
           '----------------------------------------------------------------------------------
           If  LastException.Message.Contains("EBADF (Bad file number)") Then
               Return
           End If


DonManfred I am attaching a program that under 5.1.1 that causes the problem with default notification being played.

My music program runs on a device that is connected full time to my stereo and the stereo and all it's setting are control by music program.
The program I am attaching allows me to talk to another program on the stereo device (loaded at boot) and see if the music program is running if not starts it and then relays the information of what is playing whatever device (normally my phone). My house is wired for speakers (long before bluetooth) and if I am in the shop or basement and what to turn on the music I can. I can skip songs. Mark songs as Favorites or Never Player or categorize (say it is Christmas, Thanksgiving, etc) without having to go to main device. Here is a screen shots. Note: the last screen shot is of the actual MusicDB (Music Player) software from another session

Anyway. Thanks for the help guys. If anyone has any more ideas why starting a service is causing this let me know would greatly appreciate it.

AGAIN this problem is only appearing under Android 5.1.1

BobVal
 

Attachments

  • MDBCtl.zip
    133.6 KB · Views: 245
  • BOBsCommon.zip
    184.3 KB · Views: 254
  • Screenshot_2019-02-13-23-15-24.png
    Screenshot_2019-02-13-23-15-24.png
    23.4 KB · Views: 246
  • Screenshot_2019-02-13-23-15-32.png
    Screenshot_2019-02-13-23-15-32.png
    21.9 KB · Views: 245
  • Screenshot_2019-02-13-23-15-28.png
    Screenshot_2019-02-13-23-15-28.png
    20.6 KB · Views: 245
  • Screenshot_2019-02-13-23-19-46.png
    Screenshot_2019-02-13-23-19-46.png
    37.6 KB · Views: 241
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
Actually, when I questioned you about background services, I should have said foreground services. It seems that there is a requirement to create a notification when an app starts a foreground service. I don't fully understand the implications, but it seems that maybe if you don't actually create a notification the sound will still be generated.

https://stackoverflow.com/questions...ing-sound-even-if-i-do-not-set-sound-on-older

- Colin.
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Colin: In any case you put me on the right track.

Found what is causing it:
B4X:
Service.AutomaticForegroundMode = Service.AUTOMATIC_FOREGROUND_ALWAYS

I am using the AutomaticForegroundMode in my services because I do not want them to be terminated.

SO, now I at least understand what is causing it.
Is there a way for me to stop the notification from happening? or at least playing the notification sound?

BobVal
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
Colin: In any case you put me on the right track.

Found what is causing it:
B4X:
Service.AutomaticForegroundMode = Service.AUTOMATIC_FOREGROUND_ALWAYS

I am using the AutomaticForegroundMode in my services because I do not want them to be terminated.

SO, now I at least understand what is causing it.
Is there a way for me to stop the notification from happening? or at least playing the notification sound?

BobVal

You might find a way of stopping it if you ask Mr Google, however according to the Android documentation foreground services must display a notification - so even if you do find a way of stopping it your app will probably be rejected when you submit it to Play Store.

https://developer.android.com/guide/components/services

- Colin.
 
Upvote 0
Top