Android Question Exception java.lang.SecurityException: !@Too many alarms

Douglas Farias

Expert
Licensed User
Longtime User
Hi all.
i see this error on firebase analytics and i dont know what is this.

Exception java.lang.SecurityException: !@Too many alarms (500) registered from pid 13103 uid 10220

android.os.Parcel.readException (Parcel.java:1540)
android.os.Parcel.readException (Parcel.java:1493)
android.app.IAlarmManager$Stub$Proxy.set (IAlarmManager.java:206)
android.app.AlarmManager.setImpl (AlarmManager.java:428)
android.app.AlarmManager.set (AlarmManager.java:215)
com.google.firebase.iid.FirebaseInstanceIdService.zzagl ()
com.google.firebase.iid.FirebaseInstanceIdService.zzd ()
com.google.firebase.iid.FirebaseInstanceIdService.zza ()
com.google.firebase.iid.FirebaseInstanceIdService.zzm ()
com.google.firebase.iid.zzb$2.run ()
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1112)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:587)
java.lang.Thread.run (Thread.java:818)

on the analytics have 65 crash with this error, all android api 20+ (21,22,23)
on some cases the pdi and uid number changes
21736 uid 10121 etc...

what can cause this error?
on the logs show about AlarmManager, but i dont use alarm o_O

i made a test with emulator api 21,22,23 and no errors
tested with my devices api 21 and 22 and no errors too.

thx
 
Last edited:

Douglas Farias

Expert
Licensed User
Longtime User
It is a bug in Firebase: https://groups.google.com/forum/#!topic/firebase-talk/Q_zycHnTGu0

Should be fixed for their next update.

thx erel.

any way to avoid this error on b4a?
i m getting many many errors with this, 100 to 500 erros per app
i m using try catch but dont looks help on this case. (Errors still appear in firebase analytics)

here is how i m using FirebaseMessaging Service
B4X:
#Region  Service Attributes
    #StartAtBoot: False
#End Region

Sub Process_Globals
   Private fm As FirebaseMessaging
End Sub

Sub Service_Create
   If fm.IsInitialized = False Then fm.Initialize("fm")
End Sub

Public Sub SubscribeToTopics
   If fm.IsInitialized = False Then fm.Initialize("fm")
   Try
      fm.SubscribeToTopic("general") 'you can subscribe to more topics
   Catch
        If LastException.IsInitialized Then Log(LastException)
   End Try
End Sub

Sub Service_Start (StartingIntent As Intent)
   If StartingIntent.IsInitialized And fm.IsInitialized Then
      Try
      If fm.HandleIntent(StartingIntent) Then Return
    Catch
        If LastException.IsInitialized Then Log(LastException)
    End Try
    
   End If
End Sub

Sub fm_MessageArrived (Message As RemoteMessage)
   Try
      Dim n As Notification
      If n.IsInitialized = False Then n.Initialize
      n.Icon = "icon"
      n.SetInfo(Message.GetData.Get("title"), Message.GetData.Get("body"), Main)
      n.Notify(1)
      Catch
        If LastException.IsInitialized Then Log(LastException)
    End Try
  
End Sub

Sub Service_Destroy
End Sub


on starter service i call it on Service_Create
B4X:
CallSubDelayed(FirebaseMessaging, "SubscribeToTopics")



on this post
https://groups.google.com/forum/#!topic/firebase-talk/Q_zycHnTGu0

Jacob Wenger say
For now, you can downgrade to 9.4.0 as Mihir suggested.
it is possible on b4a?


thx again
 
Upvote 0
Top