Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should be updated for Android 8.0+ #2

Open
nic0lette opened this issue Jul 30, 2018 · 1 comment
Open

Should be updated for Android 8.0+ #2

nic0lette opened this issue Jul 30, 2018 · 1 comment

Comments

@nic0lette
Copy link

Hey! These are a great set of notes, and I'm sure they'll be really helpful as a "cheat sheet" as you noted :)

There are a few issues that I've found, however. For example:

Android service is a component that is used to perform operations on the background such as playing music. It doesn’t has any UI (user interface). The service runs in the background indefinitely even if application is destroyed.

Which isn't entirely true. First, pre-Android 8.0, Services can continue to run in the background even if Activites are destroyed, but the Application is still alive (and hosting the Service, as one can see by calling getApplication()).

It also talks about IntentService, but there isn't a mention of JobIntentService or WorkManager. I think it would be valuable to add these to the discussion given they are better suited to work with the background restrictions on Android Oreo and beyond.

There's also:

The most basic approach is to add an element attribute tag android:configChanges inside the activity tag in the AndroidManifest.xml. android:configChanges="orientation|screenSize". But the cleaner thing to do is to use Onsaveinstancestate to save the data and retrieve it when onCreate is called again.

I think this could benefit from potentially discussing (or at least pointing out) ViewModels?

There is also a lot of great information here that I think could really benefit from cross-linking. That is, take the following points:

Thread should be used to separate long running operations from main thread so that performance is improved. But it can't be cancelled elegantly and it can't handle configuration changes of Android. You can't update UI from Thread.

and

Handlers allow communicating between the background thread and the main thread.

Taken separately they're great nuggets, but if there were some way to link them (I'm not sure the best way, sadly, or I would have simply opened a PR), it might be even more helpful, especially for newbies. (i.e.: You can't update the UI from a Thread, but it's possible to post a Message from a Thread to the UI thread's Handler and update the UI that way...) sort of thing.

I could also imagine it being very useful to link to some things on developers.android.com from here, so that if someone were just learning about a, for example, PendingIntent, they could click it to get the reference documentation on the class. :)

In any case! There's a lot of great stuff here, and I think that you could make it even better with some of these updates. (Sorry that I'm not being complete with my assessment. I only read about this on Reddit today and haven't gone through it in a lot of detail.)

@anitaa1990
Copy link
Owner

Hi @nic0lette thanks a lot for the feedback 👍

You are absolutely right. The sheet is not updated for Android Oreo. I will try to take some time out this week and update the sheet regarding support for Android Oreo and adding reference links.

I will keep this open till the enhancements are done :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants