Android Question Unfortunately "App Name" has Stopped

iCAB

Well-Known Member
Licensed User
Longtime User
Hello There

I am trying to display a notification message to the end user when a push notification message is received by the app
1. if the app is running in Foreground no issues
2. If the app is running in background no issues
Whoever if the user terminates the app using the task manager, upon receiving a notification message, I always get the following message displayed "Unfortunately "App Name" has Stopped" .

The code sets some global variables and executes the code below to display a notification for the user
B4X:
   NotificationInfo.Initialize
   NotificationInfo.Icon = "icon"
   NotificationInfo.Light = True
   NotificationInfo.Sound = True
   NotificationInfo.Vibrate = True
   NotificationInfo.SetInfo("iAppName", strMessage, Main)
   NotificationInfo.Notify(1)

The icon and the message are displayed as expected.
Is there a way to suppress this message?

Thanks for your help
 

iCAB

Well-Known Member
Licensed User
Longtime User
Hi Erel

Here is what it captured

** Activity (main) Pause, UserClosed = false **


Program compiled in debug mode, can only run with debugger attached.


** Service (pushservice) Create **


java.lang.RuntimeException: Unable to create service hidata.iCABLTE.pushservice: java.lang.RuntimeException: java.lang.Exception: Sub service_create signature does not match expected signature.
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2435)
at android.app.ActivityThread.access$1700(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1326)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4947)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: java.lang.Exception: Sub service_create signature does not match expected signature.
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:148)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:158)
at hidata.iCABLTE.pushservice.onCreate(pushservice.java:45)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2425)
... 10 more
Caused by: java.lang.Exception: Sub service_create signature does not match expected signature.
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:123)
... 13 more
 
Upvote 0

iCAB

Well-Known Member
Licensed User
Longtime User
I am not sure I fully understand what the signature mean in this case, but here is the code I am using

B4X:
Sub Service_Create
   
End Sub

Sub Service_Start (StartingIntent As Intent)
    Select StartingIntent.Action
   
        Case "com.google.android.c2dm.intent.REGISTRATION"
            HandleRegistrationResult(StartingIntent)
           
        Case "com.google.android.c2dm.intent.RECEIVE"
            MessageArrived(StartingIntent)
           
    End Select
End Sub
 
Upvote 0

iCAB

Well-Known Member
Licensed User
Longtime User
I definitely did try that (several times ) before I posted the issue I am facing.
 
Upvote 0

iCAB

Well-Known Member
Licensed User
Longtime User
Hi Erel, Here is the error captured with release mode

** Service (pushservice) Create **


** Service (pushservice) Start **
New message arrived: Bundle[{loc=43.804560,-79.297935, from=173276336318, alert=test, sound=alarm, collapse_key=DNM_LOC}]


java.lang.RuntimeException: Object should first be initialized (List).


at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:46)
at anywheresoftware.b4a.objects.collections.List.getSize(List.java:129)
at hidata.iCABLTE.filehandler._fh_setl_getsettingitem(filehandler.java:1894)
at hidata.iCABLTE.settings._set_getsetting(settings.java:377)
at hidata.iCABLTE.httpmessages._mmhf_builddriverstatus(httpmessages.java:417)
at hidata.iCABLTE.pushmessages._pm_decodehostmessage(pushmessages.java:396)
at hidata.iCABLTE.pushservice._messagearrived(pushservice.java:191)
at hidata.iCABLTE.pushservice._service_start(pushservice.java:268)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:174)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:158)
at hidata.iCABLTE.pushservice.handleStart(pushservice.java:68)
at hidata.iCABLTE.pushservice.onStartCommand(pushservice.java:53)


at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2864)
at android.app.ActivityThread.access$2100(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1376)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
java.lang.RuntimeException: Unable to start service hidata.iCABLTE.pushservice@29d92c8a with Intent { cmp=hidata.iCABLTE/.pushservice (has extras) }: java.lang.RuntimeException: java.lang.RuntimeException: Object should first be initialized (List).
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2881)
at android.app.ActivityThread.access$2100(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1376)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Object should first be initialized (List).
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:200)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:158)
at hidata.iCABLTE.pushservice.handleStart(pushservice.java:68)
at hidata.iCABLTE.pushservice.onStartCommand(pushservice.java:53)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2864)
... 9 more
Caused by: java.lang.RuntimeException: Object should first be initialized (List).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:46)
at anywheresoftware.b4a.objects.collections.List.getSize(List.java:129)
at hidata.iCABLTE.filehandler._fh_setl_getsettingitem(filehandler.java:1894)
at hidata.iCABLTE.settings._set_getsetting(settings.java:377)
at hidata.iCABLTE.httpmessages._mmhf_builddriverstatus(httpmessages.java:417)
at hidata.iCABLTE.pushmessages._pm_decodehostmessage(pushmessages.java:396)
at hidata.iCABLTE.pushservice._messagearrived(pushservice.java:191)
at hidata.iCABLTE.pushservice._service_start(pushservice.java:268)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:174)
... 13 more
 
Upvote 0

Eksatech

Member
Licensed User
Longtime User
I am new, sorry about this question but You wrote something about this message and believe me I tried a lot of things you wrote, but still I am living same problem, I can't start application with release compile.

When I compile in Debug (rapid) mode everything normal and application is working.

When I release the application, device says "Unfortunately "App Name" has Stopped". After Release compile the log window as this:

Installing file.
GC_CONCURRENT freed 419K, 10% free 11361K/12487K, paused 3ms+12ms, total 34ms
GC_CONCURRENT freed 410K, 10% free 11345K/12487K, paused 1ms+3ms, total 17ms
GC_CONCURRENT freed 410K, 10% free 11353K/12487K, paused 4ms+2ms, total 31ms
GC_CONCURRENT freed 426K, 10% free 11345K/12487K, paused 14ms+2ms, total 34ms
GC_CONCURRENT freed 402K, 10% free 11345K/12487K, paused 4ms+4ms, total 35ms
GC_CONCURRENT freed 402K, 10% free 11345K/12487K, paused 4ms+4ms, total 35ms
GC_CONCURRENT freed 410K, 10% free 11353K/12487K, paused 14ms+2ms, total 36ms
GC_CONCURRENT freed 346K, 9% free 11441K/12487K, paused 14ms+5ms, total 44ms
PackageAdded: package:eksatech.Butterfly

What is wrong, I can't understand. Can anyone helps me ?

Thanks in advance.
 
Upvote 0

Eksatech

Member
Licensed User
Longtime User
I solved the problem. It is interesting but If you declare a process variable and you didn't use it at the right of equal sign B4A see the variable isn't used ???

For Example:
if you declare : Dim UserID as Int at the Process Variables and use it in the code

UserID = 0, B4A says UserID isn't used, but if you equal it to another variable like: ProductID = UserID then for B4A no problem.

Why like that ?
 
Upvote 0
Top