I want to group multiple apps under the same icon in the application launcher.
For example, 5 apps each displaying 1 different image. But those 5 apps should appear as separate apps on the Android market, therefore they need to have different package name.
But different package name, means that on the Android device they will appear as 5 separate apps in the application launcher, which I am trying to avoid.
The closest solution that I found is to listen for PACKAGE_ADDED broadcast event, and every time another app from those 5 are installed on the device, all the already installed apps would call setApplicationEnabledSetting from PackageManager to hide their icons and let the app that was just installed to handle things.
But the icons are hidden only after rebooting the device.
Is there a way to force the application launcher to refresh at runtime?
Or is there any other way to solve my goal?
I am running out of options. Thanks!
Miha,
What about having one main application, with the other 4 being add-ons (i.e., not shown in the launcher)? You would then have only one launcher icon, and the other applications would be started from the main app. By checking whether the other apps were installed, you could adjust your buttons/views accordingly.
As far as I know, there is no way to force the launcher to refresh. However, you could implement your applications as you described -- having each app hide it's icon when I new one is installed. The user would get an application not installed error though, which is probably not something you want.
Personally, I used the first method: have a main keyboard and then install add-ons which can then be loaded from the main app.
Hope this helps.
Related
I'm working on Device Policies with Android for Work and have almost finished the task but for one thing - how do I make a white-listed app automatically installed?
In the white-list of apps for the Work Profile, I can see the app I've added. I'd like to make its installation automatic (or would like to know if that's possible in the first place). Here's the screen-shot:
The row is clickable, which, I hoped, would lead me to a screen with options. The URL implies so, but all I see is a blank screen.
Sorcery?
Normally, you should see a screen with "Preferences section" with 3 checkbox to set as you want :
Auto-install
Prevent users from uninstalling the app
Allow users to add widgets on the home screen
(labels might be different, I use GApps in French and I'm translating it for you right down)
And of course, you have to check the first one.
If you don't see it, it may be simply because of rights administration, even if I'm doubting, because you managed to add apps to white-list, so...
Are you allowed to make this kind of setting ? You should check what are your rights exactly. If you're not the super administrator, you should be at least Android for work Administrator. Check also if your rights are for the whole domain, or just some specific "organizations".
These settings may be changed in the users section in the Google Apps Dashboard.
I want to know the exact method which invokes/starts all the apps. I basically want to block a certain set of apps using xposed module. Its ok if the app icon is visible but the app should not be launched after clicking on it. To be precise nothing should happen when the user clicks on the app icon.
So I want to know where the source code which invokes the apps.
PS : I would also like to know if there is any way to hide the icon of the app as well.
Make your own launcher app and replace it with the ones running on mobile phones.
You can check the sources of Laucher and Laucher2 currently running on Android system.
I am intending to develop custom Launcher for Android phone. I have searched web, but I haven't found any valuable information regarding creating "launcher" project. What does an android app needs for being at the top of the GUI (aka launcher)?
I saw this thread a while ago, before creating my own launcher. Here are some crucial things I learned:
Declaring your app to be a launcher
David already mentioned the piece of code that determines your app as a launcher:
<category android:name="android.intent.category.HOME" />
Add this as an intent-filter to the activity your launcher will use for the home screen (in AndroidManifest.xml).
Launcher Issues
As a launcher will run all the time, you need to understand the activity livecycle to prevent issues (like this one).
If you want users (and yourself) to be able to constantly user the app (that's what you usually do with launchers), make sure it never crashes. In the case of a crash users will be taken back to the devices default launcher or other installed ones.
In short: Launchers are expected to be reliable.
Common launcher functions (users usually expect those)
1) A list of apps / appdrawer
From which all apps can be launched or modified. You can use packageManager to list the apps.
As generating such a list may take a while, I suggest you to do it asynchronously and save the list somewhere to speed everything up (which also is expected from launchers ^^)
2) Some settings to change the launcher
I had some users stuck in my launcher before implementing those ^^
You can open the devices launcher settings like this (in Kotlin):
// working in APIs newer than Lollipop
val callHomeSettingIntent = Intent(Settings.ACTION_HOME_SETTINGS)
startActivity(callHomeSettingIntent)
Bonus) An in-app tutorial
This may be useful if you have some features in your app that are not trivial, ways of launching apps that users don't know from other apps.
It also gets you way less messages from users asking how to interact with your software.
Resources:
The GitHub of the minimal launcher I created may be helpful: finnmglas/Launcher
Well, firstly you need to listen to the android.intent.category.HOME intent. Here are some links with full source code which you can have a look at:
Old launcher source code
New launcher source code
Or take a look at launcher plus.
When you normally want to add an AppWidget in Android there is a list where you need to pick one widget and it binds it to the home screen.
I'm trying to build an app which has its own appWidgetHost and specific App Widgets that I built for it.
I have two problems:
I would like to be able to automatically bind a widget to my AppWidgetsHost without the user picking from the list.
I want to make my own 'pick widgets list' and to load only widgets that I have created.
To make it simple; There is my app with my AppWidgets and I want full control in terms of binding a appWidget to the appWidgetHost etc.
3 people asked similar questions in Google forums:
Link 1
Link 2
Link 3
The only answer I found to be a possibility is in link number 2. Paraneet (one of the repliers) said that you can install the app under /system/app instead of /data/app because some security issue. but I'm not sure if it is a reliable solution for production, and I would like to know more about the pros and cons of doing this.
Thanks, Shai.
Unfortunatlly for you (and me), Paraneet is right.
binding appwidget is a sensitive action and thus, to avoid malware it requires the user's consent for the most part however if you install your app into the /system/data folder then you considered part of the OS and you are given a system permission which lets you decide to bind appwidget that you created without any user's involvement.
In Android O, its possible to pin app widget programmatically. Just watch at example here
Also check out Google official documentation
I am creating an Android application for a customer which will be pre-installed and distributed together with the handsets. Now the customer asked me to lock down the ROM to prevent the future users from using anything else apart from this one app. I.e. no browsing, no email, nothing which could create any costs etc.
Now after some googling it seems to be relatively straightforward to remove applications from an Android image. But even if I can remove the web browser, email client, the Android Market App etc, how can I make sure that the user will not reinstall those apps via the USB connector? As Android is just Linux I am sure there are ways of denying all users the right to install new applications (or actually denying them pretty much anything apart from using this one app).
If somebody could point me in the right direction it would be much appreciated.
EDIT:
To clarify things a bit, the customer does not want to use the android devices as phones, even though they are phones. With 100€ touch screen phones becoming available, it becomes viable to use those phones for just one specific purpose. In my customers case, the device will be used as something like a POS system: the employee uses the phone to process a certain kind of customer request, and for this the app needs to have a data connection which will accrue costs of course. Now obviously contracts can be set up that will oblige employees to pay any irregular costs themselves, but why make it that complicated?
This is not about taking freedom away from users but rather about using android phones as general purpose touch screen devices with a data connection that employees can use in a business environment without shooting themselves in the foot with unexpected high data connection cost.
There's not really a whole lot you need to do to make a single-purpose device. If you play your cards right, it should be something you can do without having to tinker with the ROM.
The quick-and-easy route would be to deploy your application as a replacement for the stock launcher, just like any of the other home replacements that are available. Setting that as the default would cover most of the opportunities for casual tampering, since it would leave no other way to launch or install anything else. The only other things I can think of off the top of my head that you'd need to do are snag the search button so it doesn't bring up the default Android search box atop your app and the green key so the phone app won't come up.
You would, of course, need a way to get to the original launcher to maintain the device and install new versions of your app. I'd accomplish that using a "Maintenance" menu item somewhere that asks for some form of authentication (e.g., a password), changes the home app back to the original and launches it. When you're done doing what you need to do, set your app as the default launcher and you're back in business.
Edit to address MAINERROR (now Octavian Damiean)'s comment:
Any activity in any application can register itself as a home application by adding an intent filter on the android.intent.category.HOME category. It's literally four lines in the manifest, and you don't have to write any code to support it. Take a look at lines 77-82 in the stock launcher's manifest for an example of how this is done. (Ignore the filters on DEFAULT and MONKEY; they're not necessary.) Once the activity is selected as the default handler for the category, it becomes the first thing launched at boot and what comes up when the Home key is pressed. HTC Sense, aHome, Panda Home, etc. all use this mechanism.
Launching the stock home (or any other application) explicitly is about five lines of code.
Side note: There's a application on the Market called Home Switcher that lets you launch any of the activities filtering on the HOME category or set one as the default.
Unless the handset manufacturer adds a lot of shovelware, the stuff that runs in the background should be inconsequential and won't get in the way.
There was a similar question already somewhere. You can indeed limit the functionality of your device by the amount you want or have to. In order to achieve this you will definitely have to build your own modified ROM.
You will have to touch the ROM because you will have to get rid of several applications running in the background. One you won't need them anyway and two as you don't need them they would only consume resources.
You might want to take a look at http://source.android.com there you will find more information about the sources which will hopefully direct you where you need.
Blrfl's answer is great, but it still has a problem: if the user long presses the HOME button, the recent applications popup will appear an the user will be able to launch another app.