Android Question Starting Apps with Black Screen Occasionally

Steve Kwok

Member
Licensed User
My App sometimes show the black screen like:

Screenshot_2018-07-09-15-42-39.png


After setting the Home as this App like:
Screenshot_2018-07-09-16-05-29.png


And Press the Home Key on the screen, the main activity launched like:
Screenshot_2018-07-09-16-05-36.png


However, after reboot, the black screen shows again.:mad:
My question is why the black screen shows occasionally regardless of HOME setting?

The manifest code is:

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="19"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
AddActivityText(Main, <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.HOME" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>)
AddActivityText(Secondary, <intent-filter>
    <action android:name="android.intent.action.SEND" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="text/plain" />
</intent-filter>)
AddActivityText(Main, <intent-filter>
    <action android:name="hk.interapp.wms1" />     
    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'CreateResourceFromFile(Macro, Themes.DarkTheme)
'End of default text.
 

Attachments

  • Screenshot_2018-07-09-15-42-39.png
    Screenshot_2018-07-09-15-42-39.png
    19.5 KB · Views: 276
  • Screenshot_2018-07-09-16-05-29.png
    Screenshot_2018-07-09-16-05-29.png
    43.1 KB · Views: 215
  • Screenshot_2018-07-09-16-05-36.png
    Screenshot_2018-07-09-16-05-36.png
    25.6 KB · Views: 197
  • B4A_Example.zip
    11.8 KB · Views: 267

DonManfred

Expert
Licensed User
Longtime User
DO NOT use
B4X:
#StartAtBoot: True
in the starterservice!
https://www.b4x.com/android/forum/threads/starter-service-consistent-single-entry-point.57599/
Notes

  • The Starter service is identified by its name. You can add a new service named Starter to an existing project and it will be the program entry point.
  • This is an optional feature. You can remove the Starter service.
  • You can call StopService(Me) in Service_Start if you don't want the service to keep on running. However this means that the service will not be able to handle events (for example you will not be able to use the asynchronous SQL methods).
  • The starter service should be excluded from compiled libraries. Its #ExcludeFromLibrary attribute is set to True by default.
  • The starter service should never be explicitly started. This means that if you want to start a service at boot then add a different service.


You should use another service and set the flag here.


I do not use your app as launcher but so far it is working for me.
 
Upvote 0

Steve Kwok

Member
Licensed User
Dear DonManfred,
After changing starter service to
B4X:
#StartAtBoot: False
,
the app can go to main activity each reboot. It works and thank you so much!
By the way, what is the purpose of StartAtBoot of Starter service? It seems to be useless and harmful.
 
Upvote 0
Top