← Back to team overview

ubuntu-phone team mailing list archive

Re: SDK planning

 

Hi!

I would like for our platform to be more strict about apps doing network
operations in the main thread. This is something that would largely help
our apps stay smooth and snappy. As an example Android does not allow
developers to do network requests on the UI thread, any such attempt
results in a NetworkOnMainThreadException. This definitely results in a
more crisp experience.

Perhaps we could provide some sophisticated API for the developers so that
they don't really have to handle threading directly, atleast for simpler
operations. (If there already is please enlighten me).

Android provides AsyncTask[1] to do exactly that. So basically it provides
a few override methods

doInBackground(): any code that runs inside this method is executed in a
worker thread.
onPreExecute(): here you may show some nice spinner/dialog to tell the user
something is being downlaoded (main thread)
onPostExecute(): this is called after the background operation completes.
(main thread)

iOS has Grand Central Dispatch[2] for similar reasons, though I don't
really know how that works so can't detail that out.


[1] http://developer.android.com/reference/android/os/AsyncTask.html
[2]
https://developer.apple.com/library/ios/documentation/Performance/Reference/GCD_libdispatch_Ref/

On Wed, Mar 16, 2016 at 11:20 PM, Zoltán Balogh <zoltan.balogh@xxxxxxxxxxxxx
> wrote:

> hi all,
>
> I wrote up few thoughts about the plans of the SDK team for the upcoming
> cycle:
> https://developer.ubuntu.com/en/blog/2016/03/16/planning-the-sdk-16-10/
>
> Nothing is carved to marble, so if you have comments, ideas or requests
> please tell us.
>
> cheers,
>
> bzoltan
>
> --
> Mailing list: https://launchpad.net/~ubuntu-phone
> Post to     : ubuntu-phone@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~ubuntu-phone
> More help   : https://help.launchpad.net/ListHelp
>

Follow ups

References