Developing a standalone version of the MyApps widget

I’ve started working on it! :slight_smile: Currently the widget is standalone and can be displayed, but the data is missing. This is because previously the Launcher collected the necessary information (e.g. every time a app was started, the Fairphone Launcher stored that information to calculate usage stats).

To make it work without the Fairphone Launcher, I will use the Android UsageStatsManager. This, however, needs special permissions from the user while adding the widget and requires us to use API level 21 (Android 5.0 and above).

I will probably need a few weeks until this works well. In the meantime, I will send you PM’s with beta versions you can test. :wink: If anyone else is interested in testing the MyApps widget, just drop me a message.

Edit: Download the current beta version (0.0.2) here. The source code is available on GitHub.

12 Likes

Wow, that’s the spirit! :smiley: This deserves its own topic!

Awesome! If you need some real code examples, I’m sure Hangar (source) uses that API as well.

Also, feel free to create and manage a repo in the WeAreFairphone GitHub org. Ping me if you need something

3 Likes

Thanks, the Hangar source code will definitely be useful. The main problem with UsageStatsManager so far is that it is not possible to access the amount of app launches (which is used to determine the most used apps).

Furthermore I have to find an elegant way to update the widget, the Fairphone Launcher could do this every time it launched an app. This is espacially annoying when launching an app from the widget itself, because the user kind of expects the widget to update the list of recent apps immediately. I could probably solve this by adding another layer of indirection when an app is launched from the widget.

I tried to modify the original source code as little as possible, so in the future we might be able to include new features that we have added to this widget in the Fairphone Launcher as well.

I will continue to work on it in the coming days and release a beta here in the forum as well as the source code on GitHub.

Here is a screenshot showing how the widget currently looks like on my tablet:

Edit: Ah! And the “All Apps” button currently only works with the Fairphone Launcher. I’m not sure if there is a general way for all launchers to access the app drawer. I could think of either adding support for some launchers or removing that button entirely (or make it configurable).

3 Likes

Nice!

For me it seems the whole widget is only available in the Fairphone Launcher. In Catapult I don’t have it in my list of Widgets. In the Fairphone Launcher in return it works better than the original! :open_mouth:
I use Catapult as my main launcher and the Fairphone Launcher’s My Apps Widget doesn’t seem to register app usage when the app is not launched via the FP launcher. I put the new Widget besides the original (I’m still on Android 5, FP Open, duh!) and already it shows the apps that I really used recently and not those I used before switching launchers.
On the other hand - like you said - the new Widget doesn’t update the exact moment I launched an app, while the original widget does.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.