Direct Share
ClosedPublic

Authored by nicolasfella on Jul 16 2017, 7:21 PM.

Details

Reviewers
albertvaka
Group Reviewers
KDE Connect
Commits
R225:bea90521c5d9: Direct Share
Summary

Support Android 6 direct share.
BUG:362266
BackgroundService is a SIngleton now. This should only be used if strictly necessary.

Test Plan

Pick a random app with a share button, look for device entries in Sharing options (might not be there because other sharing options have higher priority)

Diff Detail

Repository
R225 KDE Connect - Android application
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
nicolasfella created this revision.Jul 16 2017, 7:21 PM
nicolasfella edited the summary of this revision. (Show Details)Jul 16 2017, 7:29 PM

Made BackgroundService a Singleton. Could not find any obvious problems. Using this approach could simplify the code on many places.

What do you guys think about this?

What do you guys think about this?

I'm already running it on my phone :) But I also don't like the way to get the devices from the background service... I was waiting to have a bit more of time to try other solutions, but I haven't really looked into it yet.

I'll try to work on it this week.

albertvaka accepted this revision.Jul 29 2017, 8:10 AM

I try to avoid statics (and hence singletons) in Android, because Android can decide to unload classes when it's low on memory, and then static variables on that class become null.

Unfortunately, I can't find any way of doing it without having a singleton class, because the ChooserTargetService has no way to access anything...

So, I guess we will have to stick with this approach.

src/org/kde/kdeconnect/Plugins/SharePlugin/ShareActivity.java
176

I think here we can use the BackgroundService.RunCommand construct, instead of using the singleton... I would prefer if we only use the singleton when it's 100% necessary (ie: only from the ChooserTargetService).

This revision is now accepted and ready to land.Jul 29 2017, 8:10 AM
nicolasfella edited the summary of this revision. (Show Details)Jul 29 2017, 9:32 AM
nicolasfella marked an inline comment as done.
This revision was automatically updated to reflect the committed changes.