Home | Sign in | English EN
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Stored procedures
Makes a thread persistent.
The application is not stopped as long as at least one persistent thread is currently run (even if all its windows have been closed).
Using a persistent thread allows you to:
  • continue playing music even if the window is closed.
  • transmit GPS coordinates on a permanent basis.
// Start the thread that triggers the reading of a sound track
ThreadExecute("MyThread", threadGlobalContext, ProcPlayMusic)

// Creates the notification to display while playing the sound track
Notif is Notification
Notif..Title = "Playing..."
Notif..ActionClick = ProcStopMusic

// Makes the persistent thread to prevent the application from closing
// as long as the thread is not ended
ThreadPersistent("MyThread", Notif)
<Result> = ThreadPersistent(<Thread name> , <Notification to Display>)
<Result>: Boolean
  • True if the thread was made persistent,
  • False if an error occurred. To get the details of the error, use ErrorInfo with the errMessage constant.
<Thread name>: Character string (with quotes)
Name of the thread that must become persistent. This name is given when running the thread (ThreadExecute). This thread must exist and it must use the global context of the application.
<Notification to Display>: Notification variable
Name of the Notification variable corresponding to the notification that must displayed during the execution of the persistent thread.
This notification must not be already displayed. If a persistent thread is currently run during the call to ThreadPersistent, the notification associated with this thread will be replaced by the specified notification. When the thread execution is ended, the notification will be automatically hidden if no other persistent thread is in progress.
  • A notification is necessarily displayed during the execution of a persistent thread. Therefore, the user is informed that the started application is still running even if no window is opened. He can take control over this application during a click on the notification.
    The application can also be restarted during a click on the notification: to do so, specify ..ActivateApplication in the Notification variable.
  • Tip: No window must be opened from a persistent thread. The windows can be opened from the procedure called by the notification for example.
Related Examples:
Android Persistent Notifications Android (WINDEV Mobile): Android Persistent Notifications
[ + ] This example is used to create persistent notifications that appear even if the application is not used anymore.
A persistent thread run when the starting device is used to send the notifications.
Component: wd260android.jar
Minimum version required
  • Version 18
Click [Add] to post a comment