I want to send Email Reminders in my app. I succesfully tried it from an activity.
Now I want to send it from a receiver in the background.
The 'ScheduledEmailReceiver' calls himself via
Permission SCHEDULE_EXACT_ALARM is granted.
Later on I try to send an Email in the same context of Receiver_Receive
The Problem occurs at line
in this code block:
Error:
Is it not possible to call OAuth2_AccessTokenAvailable from a receiver?
There were some posts about FirebaseMessaging and setting priority to 10. Is it possible to set the priority for OAuth2_AccessTokenAvailable as well?
Now I want to send it from a receiver in the background.
The 'ScheduledEmailReceiver' calls himself via
B4X:
Private Sub Receiver_Receive (FirstTime As Boolean, StartingIntent As Intent)
'[...]
StartServiceAtExact(Me,Starter.NextCheck,True)
'[...]
Later on I try to send an Email in the same context of Receiver_Receive
The Problem occurs at line
B4X:
Wait For OAuth2_AccessTokenAvailable (Success As Boolean, Token As String)
in this code block:
B4X:
Sub Send (msg As MailCreator)
Starter.oauth2.GetAccessToken
Wait For OAuth2_AccessTokenAvailable (Success As Boolean, Token As String)
If Success = False Then
Log("Error accessing account.")
Return
End If
Error:
B4X:
*** Receiver (scheduledemailreceiver) Receive ***
** Activity (main) Pause, UserClosed = false **
java.lang.RuntimeException: Unable to start receiver b4a.fahrstundenPlaner.scheduledemailreceiver: java.lang.RuntimeException: anywheresoftware.b4a.B4AUncaughtException
at android.app.ActivityThread.handleReceiver(ActivityThread.java:4852)
at android.app.ActivityThread.access$1700(ActivityThread.java:315)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2297)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8751)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
Caused by: java.lang.RuntimeException: anywheresoftware.b4a.B4AUncaughtException
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:188)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
at b4a.fahrstundenPlaner.scheduledemailreceiver.onReceive(scheduledemailreceiver.java:42)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:4843)
... 9 more
Caused by: anywheresoftware.b4a.B4AUncaughtException
at anywheresoftware.b4a.Msgbox.debugWait(Msgbox.java:210)
at anywheresoftware.b4a.debug.Debug.wait(Debug.java:217)
at anywheresoftware.b4a.shell.Shell.debugPause(Shell.java:544)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:417)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
... 12 more
Is it not possible to call OAuth2_AccessTokenAvailable from a receiver?
There were some posts about FirebaseMessaging and setting priority to 10. Is it possible to set the priority for OAuth2_AccessTokenAvailable as well?