How to keep an Android Service always running? - voip

I am building an Android VOIP application that has a service which handles the registration for the client (PJSIP in my case).
For now i am starting a normal service and using the return START_STICKY in order to keep my service up and running all the time since the user needs to be registered 24/7. But that is not the case as i find my self not registered after a while.
What is the best solutions for issues like these?
Make service start in foreground?
I would like to hear your thoughts!

Related

Why my application ran by Fast Startup? How to prevent that?

Here's a weird one. My application(MFC, really out one) relies on a service(C++). Both app and service are my coding. And I found if I shutdown my PC while app running and power-on, the app will be ran by system. And it doesn't work well with my service.
To be more detailed, my app and service communicate through NamedPipe, so if the app ran by system, it could go wrong.
Which already has been confirmed is that if I turned off 'fast startup' in power option and my app won't run after a shutdown then power-on action any more.
My app won't run with 'restart' exactly match the description of
system option
I promised that I didn't add any 'let my app run by fast startup' that kind of code.
I'm really confusing right now and there're few articles about Windows Fast Startup mechanism. I did found an article from MSDN about fast-startup boot and cold boot. But it's all about drivers, not Win32 desktop apps.
Here's the link:
https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/distinguishing-fast-startup-from-wake-from-hibernation
Could anyone please help?
No code for now.
I don't want my app ran by system automatically.
(btw, in common sense, we should initially code for that, but

Node Red - Accessing dashboard from remote server

I have a question regarding the Node Red dashboard. I've got my dashboard all set up and working. Now, I want to be able to access the dashboard outside of my local network. Right now I do this through a VNC server. What needs to happen next is that clients need to able to access the dashboard, but they are not getting access to my VNC server of course. I have done my fair amount of Google work. I (somewhat) understand that a service like ngrok (ngrok.com) or dataplicity (dataplicity.com) is what I am looking for. What would be the best way of setting this up safely?
Might be useful to clarify: I'm using a raspberry Pi!
Thanks in advance!
If you want to give the outside world access to your dashboard, you can also consider to host your node-red application in the cloud. See links at the bottom-left of page https://nodered.org/docs/getting-started/
Most of those services have a free tier - so it might you cost nothing.
If you cannot deploy your complete node-red in the cloud (e.g. because it is reading local sensors) then you can split your node-red application into 2 node-red applications: one running locally and one (with the dashboard) running in the cloud. Of course then the 2 node-red applications need to exchange messages: for this the cloud services mentioned on that page also provides a secure way to send and receive events from the node-red cloud application that you can use.

Alternatives for Application Insight reg:

I have an existing on-prem/Cloud environment in which am running my enterprise application and I would like to implement Application Insight to capture telemetry. But I have few issues on it. Are there any alternatives to use application insights? I have two concerns here:
1) it might not be possible to install softwares in production environment 2) restarting IIS Server would pull all the sites down at least for a minutes or two. It would be great if some one can suggest alternatives of leveraging these App Insights. Thanks in advance :)
there are 2 ways to use Application insights:
1) using the sdk, where you add the sdk to your service. At some point you have to deploy the service, so when you deploy, you'd also deploy app insights into that service
2) using status monitor, which does require restarting IIS. using status monitor isn't required, but does let you collect extra and detailed information that you wouldn't get from the sdk alone.
A lot of people end up doing both, (1) so they can do custom collection of events, traces, etc, and (2) to get detailed dependency calls
But like AlexB suggested, setting up something where you can swap between slots is one of the best ways to set things up, if possible, so you can just swap between the slots without having any downtime at all.

Scheduler on Azure

I need to be able to generate some type of Scheduling service within Windows Azure, but which is the best and most resilient?
Currently I have a Windows Service running Quartz, which works okay, but on a Windows Server. I need this to run in the cloud.
The tasks, read/write to a database and some will send emails.
I've looked over all the possible solutions in Stack Overflow, but they appear to be old and not updated to the latests Azure Platform.
Any suggestions or pointers?
The most adapted solution might be a worker role, MS has a tutorial specifically for what you're looking for: http://www.windowsazure.com/en-us/develop/net/tutorials/multi-tier-web-site/4-worker-role-a/
This would definitely a less expensive solution than instantiating a virtual machine, but might require some work.
I ended up using the Azure Mobile service and the Scheduler that come with it, which works a treat
I run a Worker Role using Quartz .NET to schedule stuff. Works great!
https://github.com/quartznet/quartznet
Obviously, that would be difficult to do on the cloud since you won't be able to install services or anything that could run in the background. A less than perfect solution would be to have a workstation under your control handle the scheduling and send updates to the web server which would then write them to the DB server. Otherwise, you should self host the website and application, etc.

JavaFX console service with GUI

I need to make an application that runs as a server that accepts connections from various clients and responds to their requests (via proprietary protocol). This server also needs a GUI for configuration and monitoring. I (of course) need to run the server as a service, and the GUI has to be available only at certain moments. Since the server service and GUI share some of the hardware resources and part of the configuration they would run on the same machine. I would like that the GUI and the whole long running service are one process that will run in the background; the GUI would than be invoked (shown) only when needed.
My question is: can this be done with a JavaFX 2 GUI and how?
Thanks in advance
Josip
So you need Monitoring and Management in a Java application? You should be using the Java Management Extensions (JMX) Technology. http://docs.oracle.com/javase/6/docs/technotes/guides/management/overview.html
And if you decide that you can't just use a standard JMX client or create a plugin then you create your JavaFX application as a JMX client.

Resources