Can Someone explain me what Ti.UI.Tray is for? I want to create a system tray application that displays notifications on update and when the user closes the window it goes into system tray instead of exiting and the user closes the application by explicitly choosing to exit. Can Ti.UI.Tray be used for this? If not, is there any other way to make a tidesdk system tray application for each of the windows,osx and linux platforms
Related
When opening an Unity app on the MSFT HoloLens it first creates a blank white box for the User to position and place via gestures. After the user has placed this white box, the application launches. The user can exit the app (but not necessarily close it) by performing the 'bloom' gesture. The app won't be running and the previously mentioned white box should re-appear (to denote this 'paused' state, as it were, between running and closed).
The issue is sometimes the app might have been exited and this white box doesn't appear. If the white box isn't present then the user can't close the application normally (by clicking the X in the top right). Likewise, if the app was exited and the user doesn't remember this when returning for their next session, they will naturally try to launch the application again. If the previous session was never actually closed it can cause issues with the newly opened session.
How do I restrict HoloLens from opening up a second instance of my Unity app, provided a session was previously opened and left either running or never closed?
Ideally if the app is already opened, when a user tries to open the app the HoloLens would refresh the previously existing instance and bring it to the users view or forcibly close the previous session before trying to open the new one (to avoid undesired behavior).
Is the best and most reliable way to handle this by enforcing a single instance of an Unity app on HoloLens? Or to detect if an instance is open and close that instance before trying to open the app again? Which, if either, is preferred or is it up to preference?
External resources I have found on this topic (a few of many):
How to determine if app is running on HoloLens - most relevant source of information I have found on the topic. Unfortunately it doesn't go into what to do with the affirmation that the app is open.
Unity Script Reference - WSA (Windows Store app) - again doesn't mention enforcing single running instance
Unity Script Reference - OnApplicationQuit - not sure if this is applicable to the situation but, there is a method Unity "sends to all game objects before the application is quit".
WIP:
private void App_Resuming(Object sender, Object e)
{
if (UnityEngine.VR.VRSettings.loadedDeviceName.Equals("HoloLens"))
{
UnityEngine.VR.VRDevice.SetTrackingSpaceType(UnityEngine.VR.TrackingSpaceType.Stationary);
UnityEngine.VR.InputTracking.Recenter();
UnityEngine.VR.VRDevice.SetTrackingSpaceType(UnityEngine.VR.TrackingSpaceType.RoomScale);
}
}
In the Initialize method (inside of 'App.cs')
public virtual void Initialize(CoreApplicationView applicationView)
Add
CoreApplication.Resuming += App_Resuming;
Can't test this at the moment as Hololens will connect to an network and spit out "No internet, connected" (tried both protected/unprotected networks). Device possibly needs an update, but we can't check for updates without a network connection.
For clarification, this is not a hololens specific question, where you need to look is in the windows 10 sdk, in windows 8 it was called tombstoning, its the act of moving away from an application without closing and being able to resume, Here is a link to an article about maintaining state in a windows 10 application, it's too long of a discussion and explanation to do it justice here.
https://visualstudiomagazine.com/articles/2015/09/01/its-universal.aspx
https://learn.microsoft.com/en-us/windows/uwp/launch-resume/app-lifecycle#app-execution-state
In my application I have a Socket Connection to a server, in Android this is running in a Android.App.Service, this works as it should even when the app is
minimized/suspended. I am no working on the Windows Phone part, I tried to create a new Thread(SendAndRecieveAction) { IsBackground = true }; but when I press the windows button and the application gets minimized all the resources gets cleared (Sockets gets closed even though it has an keep alive packets). How can I implement my Sockets in Windows phone that when the user minimizes the application the Sockets would not end
In Windows Phone there is no way to run your code permanently in background as a kind of a service. You can use a PeriodicTask that opens a socket every time it runs. To learn more about PeriodicTasks and background tasks in general you should read this: https://msdn.microsoft.com/en-us/library/windows/apps/hh202942%28v=vs.105%29.aspx
I want some operations to be performed in background when my app was closed. is it possible in ios
Short answer; YES it is possible to have an application running in the background.
If you close the application by pressing the home button, the application is "freezed" unless you specify it should run in the background. But there are some limitations, see my explanation below.
If you kill the application, it is not possible for it to run in the background. No application will survive when you kill it. Killing is done like this; double-click the home button and then long press the application. Finally you press the application. This will kill the application.
The biggest limitation is that your application needs to be of certain type, otherwise it is not allowed to execute in the background. This is specified in the Info.plist file. Specifically you need to add the UIBackgroundModes in the Info.plist file. If it another type of application and try to run in the background, the application will be rejected for publishing in Appstore.
These are the types of applications that are allowed to execute in the background:
Audio applications
Location applications
VoIP applications
Newsstands applications
Applications that polls external accessories
Then there are certain rules that the application needs to follow certain rules. Everything is explained here.
I'm trying to unlock my mac using my iPhone via bluetooth proximity, the code I'm using:
tell application "System Events"
tell security preferences
set require password to wake to false
end tell
end tell
tell application "ScreenSaverEngine" to quit
It kills the screensaver, doesn't show the password box but all I get is a black screen. All applications still running but I'm hovering the mouse on this black screen.
I'm running two monitors on a 10.6.7 build.
What's wrong? Thanks.
lifehacker article http://lifehacker.com/5816791/use-a-bluetooth-phone-or-device-to-lock-and-unlock-your-mac-when-youre-near
You could try an alternative way to kill the screen saver, such as a shell script with
#!/bin/sh
killall ScreenSaverEngine
And calling it directly, or writing an applescript to call it if you'd like that for some reason to do with the lifehacker article.
I have an app that will run in the background but there is one case where I do not want that to happen, can I achieve this programmatically?
I know I can opt out by changing this plist value but what about at run time?
Add the variable UIApplicationExitsOnSuspend (Application does not run in background) to your applications plist and assign the value YES.
You can close the app by calling exit(0) in applicationDidEnterBackground.
You can't use exit(0) b/c apple does not allow you to close the app without user knowing it.
From Technical Q&A QA1561 How do I programmatically quit my iPhone application?.
There is no API provided for gracefully terminating an iPhone
application. Under the iPhone OS, the
user presses the Home button to close
applications. Should your application
have conditions in which it cannot
provide its intended function, the
recommended approach is to display an
alert for the user that indicates the
nature of the problem and possible
actions the user could take - turning
on WiFi, enabling Location Services,
etc. Allow the user to terminate the
application at their own discretion.
Calling exit() is discouraged, and not informing the user that the app is going to terminate is also discouraged. So you need to get the OS to kill your app (as it normally would do over a long enough period of operation) while simultaneously informing the user. One way of doing this, while using only legal APIs, is to dirty absolutely as many memory pages as possible (malloc and bzero), then call Safari with a URL to a hoggish website explaining why the app is going to quit. Safari will require enough memory to display the website that your app will be terminated by the OS, just as the user is being properly informed.
Sleeping until the OS kill timer kills your app will also kill your app, but this non-responsive delay will lock up the UI, which isn't a good user experience.