PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
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.
Example
// 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)
Syntax
<Result> = ThreadPersistent(<Thread Name> , <Notification to Display>)
<Result>: Boolean
  • True if the thread was made persistent,
  • False if an error occurred. To find out the error details, use ErrorInfo associated 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.
Remarks
  • 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.
Components
Android wd230android.jar
Minimum required version
  • Version 18
Comments
Click [Add] to post a comment