Android Question StartAtBoot trouble (double initiallize)

Diego Marcelo Croatto

Member
Licensed User
Longtime User
Hello everyone!.... I have a trouble with the StartAtBoot of my application.

I start or reboot my Tablet and after boot the tablet shows this message:.

The CMD Counter (my application name) was stoped

Screenshot_20200429-000423.png


I press Accept (Aceptar) and the tablet shows this screen.....

Screenshot_20200429-000450.png


and after a few seconds the application start normally.....

Screenshot_20200429-000505.png


I can't find the error!

The code in Starter is from StartAtBootSample

Starter:
#Region  Service Attributes
    #StartAtBoot: True
    '#ExcludeFromLibrary: True
#End Region

Sub Process_Globals
    
    Public admin As AdminManager
    Public IDList As List                    ' list containing the IDs of the database
    
End Sub

Sub Service_Create

    Dim i As Intent
                
    i.Initialize("", "")
    i.SetComponent("CMDCounter.com/.main") '<-- Replace this with the name of your package

    StartActivity(i)
                
    StopService("")

End Sub

Thank' a lot! ;)
 

Diego Marcelo Croatto

Member
Licensed User
Longtime User
Hello everyone!.... I have found it causing the problem! but I dont know how to solve it...

This part of code in the manifest file cause the problem.

USB_DEVICE_ATTACHED:
AddActivityText(main, <intent-filter>
    <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>
    <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
        android:resource="@xml/device_filter" />)


When I put the code the program start automatically ( with #StartAtBoot: False )

shows: (Aplication stoped)

1588280332117.png


and crash after every startup or reboot .

If I comment this piece code the program start up ok

At first time at running the program the system shows the permission of the usb device.

Screenshot_20200430-174531.png


I select and accept but the serial port don't work.
I close the program and run it newly and now the serial port works but if I restart the system... I need accept the USB permision each time.

Any suggestion please!.... Thank's a Lot
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You should find the error message in the logs and post it.

I close the program and run it newly and now the serial port works but if I restart the system... I need accept the USB permision each time.
This is a known issue that happens on some devices. Assuming that you configured the xml file correctly then there is nothing that you can do about it.
 
Upvote 0
Top