[SailfishDevel] Pull data in background
Nicolas Cisco
ncis20 at gmail.com
Mon May 4 22:43:26 UTC 2015
Thansk Andrey!, i managed to do it with dbus, for the record i've written a
blog post with the code:
http://nckweb.com.ar/sailing-code/2015/05/04/closing-an-application-without-killing-the-main-loop/
Tomasz Sterna, i didn't know that telepathy protocol existed nor it was
implemented on sailfish. Are there some example, documentation, or sth to
read about how to use it?.
Thanks everyone!.
2015-05-04 6:02 GMT-03:00 Andrey Kozhevnikov <coderusinbox at gmail.com>:
> you need to do it in separate class and implement dbus service for
> showing running instance when click icon again. try to do it yourself and
> tell me if you will not success, i'll give you minimal example.
>
> 04.05.2015 06:09, Nicolas Cisco пишет:
>
> I've create the gui view and set "setQuitOnLastWindow" to false. The
> problem i'm having is that when the app gui is closed (the app continues
> running on background), but the user can't open it again. How can i reopen
> the gui view when the user clicks on the menu button of the app?.
>
> The main code:
>
>> int main(int argc, char *argv[])
>> {
>> // SailfishApp::main() will display "qml/template.qml", if you need more
>> // control over initialization, you can use:
>> //
>> // - SailfishApp::application(int, char *[]) to get the QGuiApplication
>> *
>> // - SailfishApp::createView() to get a new QQuickView * instance
>> // - SailfishApp::pathTo(QString) to get a QUrl to a resource file
>> //
>> // To display the view, call "show()" (will show fullscreen on device).
>> //return SailfishApp::main(argc, argv);
>> QGuiApplication *app = SailfishApp::application(argc, argv);
>> QQuickView *view = SailfishApp::createView();
>> app->setQuitOnLastWindowClosed(false);
>> view->setSource(SailfishApp::pathTo("qml/background.qml"));
>> view->show();
>> MyTimer t;
>> qDebug() << "Running!";
>> int ret = app->exec();
>> qDebug() << "Closes!" ;
>> return ret;
>> }
>
>
> MyTimer is just a class inherited from QTimer which prints "Running"
> each 3 secs.
>
> 2015-05-02 23:50 GMT-03:00 Andrey Kozhevnikov <coderusinbox at gmail.com>:
>
>> Just make gui view in your application creatable by request and do not
>> quit application when window is closed.
>>
>> 03.05.2015 06:27, Nicolas Cisco пишет:
>>
>> Hi,
>> i'm developing a messaging app (server and client) for a subject at
>> university. The proyect involves developing a server with a REST protocol
>> and an android application. In order to have a real case to use it to
>> compare developing an app for android and salifish, i thought that it would
>> be a good idea to also implement the client for salifish.
>>
>> The protocol is quite simple, i already managed to develop the server,
>> tested via terminal and send messages using a simple qml app (basically i'm
>> doing ajax calls). My problem is how should i poll notifications and
>> messages. I have to periodically send an ajax call/http request to an url
>> (eg: http://<server addr>/notifications) and the server will answer me
>> with a json with all the new messages.
>>
>> My first idea is that the qml app pulls the data directly, but, if the
>> app is closed, no more data is pulled. Can the qml app start a service
>> (which runs on the backgound) in order to continue the pulling of data?.
>>
>> My second idea is to run a daemon which periodically pulls displays
>> notification and communicates with the qml app via dbus. But, i've read
>> that daemons aren't allowed in harbour apps, i want to use this prototype
>> as a real test case of what will be shipping an app to Harbour.
>>
>> Which would be the correct / recommended way to pull information from a
>> server periodically (in the background)?.
>>
>> Regards,
>> Nicolas.
>> --
>> Nicolas Cisco
>> www.nckweb.com.ar
>>
>>
>> _______________________________________________
>> SailfishOS.org Devel mailing list
>> To unsubscribe, please send a mail to devel-unsubscribe at lists.sailfishos.org
>>
>>
>>
>> _______________________________________________
>> SailfishOS.org Devel mailing list
>> To unsubscribe, please send a mail to
>> <devel-unsubscribe at lists.sailfishos.org>
>> devel-unsubscribe at lists.sailfishos.org
>>
>
>
>
> --
> Nicolas Cisco
> www.nckweb.com.ar
>
>
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to devel-unsubscribe at lists.sailfishos.org
>
>
>
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to
> devel-unsubscribe at lists.sailfishos.org
>
--
Nicolas Cisco
www.nckweb.com.ar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20150504/7aa6646b/attachment-0001.html>
More information about the Devel
mailing list