asales Expert Licensed User Longtime User Oct 28, 2022 #1 I'm trying to migrate my old projects (that is non b4xpages) to Android 31. Some projects has an alarm in 3 times of the day. I use this code to calculate the next schedule. And this code to the service with notification: B4X: Copy t = FindNextTime(Array As Double(10+30/60, 15+30/60, 20+30/60)) CancelScheduledService(Alarme) 'StartServiceAt(Alarme,t,True) StartServiceAtExact(Me,t,True) If I change the StartServiceAt to StartServiceAtExact, I get this error below when the app starts. If I use StartServiceAt, I don't get this error. I tried to reproduce this error in a small project (activity and b4xpages) without success. What could be the problem? Any help are welcome. Thanks. Spoiler: Error B4X: Copy main_vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv2 (java line: 887) java.lang.ClassNotFoundException: br.com.apps.profile.main$main_BR at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:454) at java.lang.Class.forName(Class.java:379) at anywheresoftware.b4a.keywords.Common.getComponentClass(Common.java:978) at anywheresoftware.b4a.keywords.Common.createPendingIntentForAlarmManager(Common.java:947) at anywheresoftware.b4a.keywords.Common.StartServiceAtExact(Common.java:938) at br.com.apps.profile.main._vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv2(main.java:887) at br.com.apps.profile.main._criar_menu(main.java:2133) at br.com.apps.profile.main._vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv0(main.java:1943) at br.com.apps.profile.main._startpage(main.java:5325) at java.lang.reflect.Method.invoke(Native Method) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213) at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1084) at anywheresoftware.b4a.keywords.Common.CallSubNew(Common.java:1031) at br.com.apps.profile.main$ResumableSub_SplashAnimation.resume(main.java:5284) at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1716) at android.os.Handler.handleCallback(Handler.java:914) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:225) at android.app.ActivityThread.main(ActivityThread.java:7563) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:994) Caused by: java.lang.ClassNotFoundException: br.com.apps.profile.main$main_BR ... 23 more
I'm trying to migrate my old projects (that is non b4xpages) to Android 31. Some projects has an alarm in 3 times of the day. I use this code to calculate the next schedule. And this code to the service with notification: B4X: Copy t = FindNextTime(Array As Double(10+30/60, 15+30/60, 20+30/60)) CancelScheduledService(Alarme) 'StartServiceAt(Alarme,t,True) StartServiceAtExact(Me,t,True) If I change the StartServiceAt to StartServiceAtExact, I get this error below when the app starts. If I use StartServiceAt, I don't get this error. I tried to reproduce this error in a small project (activity and b4xpages) without success. What could be the problem? Any help are welcome. Thanks. Spoiler: Error B4X: Copy main_vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv2 (java line: 887) java.lang.ClassNotFoundException: br.com.apps.profile.main$main_BR at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:454) at java.lang.Class.forName(Class.java:379) at anywheresoftware.b4a.keywords.Common.getComponentClass(Common.java:978) at anywheresoftware.b4a.keywords.Common.createPendingIntentForAlarmManager(Common.java:947) at anywheresoftware.b4a.keywords.Common.StartServiceAtExact(Common.java:938) at br.com.apps.profile.main._vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv2(main.java:887) at br.com.apps.profile.main._criar_menu(main.java:2133) at br.com.apps.profile.main._vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv0(main.java:1943) at br.com.apps.profile.main._startpage(main.java:5325) at java.lang.reflect.Method.invoke(Native Method) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213) at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1084) at anywheresoftware.b4a.keywords.Common.CallSubNew(Common.java:1031) at br.com.apps.profile.main$ResumableSub_SplashAnimation.resume(main.java:5284) at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1716) at android.os.Handler.handleCallback(Handler.java:914) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:225) at android.app.ActivityThread.main(ActivityThread.java:7563) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:994) Caused by: java.lang.ClassNotFoundException: br.com.apps.profile.main$main_BR ... 23 more
Erel B4X founder Staff member Licensed User Longtime User Oct 28, 2022 #2 Based on the error message, you are passing an activity instead of a service. Upvote 2
asales Expert Licensed User Longtime User Oct 28, 2022 #3 My bad. Thanks for the clarification. I passed "Me" instead the service name. Correct code: B4X: Copy StartServiceAtExact(Alarme,t,True) Upvote 0
My bad. Thanks for the clarification. I passed "Me" instead the service name. Correct code: B4X: Copy StartServiceAtExact(Alarme,t,True)