Only displaying pre-installed applications on android device - android

So I am using the Home sample to build an application that creates a second home screen for the user. The idea is to be able to have only one user account yet restrict certain access to chosen applications. I have managed to ensure that all of the applications are invisible in the XML yet I am struggling with how to change this to make certain apps visible.
Is it possible to write a whitelist of accepted apps for instance the preinstalled apps or child friendly apps for children who game using the android device and then put in a Java method to access this white list? This is the only way I can think to make it work.
If anyone knows the correct way can you please help.
Thanks.

Ok so I discovered how to do this.
In the home sample they provide a for loop in the Home.java file that covers all apps and displays them. It take a simple if statement to restrict the apps that can be viewed -
// for loop is here
if (info.activityInfo.applicationInfo.packageName.contains("com.android"))
//then the rest of the home sample is here.
Still very basic but provides me with a good enough UI so that kids cannot see apps I don't want them to.

Related

How to overlay information on Android's launcher app?

I want to create an accessibility feature for Android where a hint appears whenever a person presses or long-presses on an app icon. To do, this I have a few questions:
How to identify when a user clicks on the icon of an app on the
homescreen or app launcher?
How to make use of this event to then
pull appropriate information and present it to the user?
Do I need to develop a custom launcher app to be able to identify user presses etc.? Or can I somehow retrieve this information from whatever launcher a user uses and give the hint?
There are a couple of different ways to get after the information you are looking for.
The first option is to create a custom launcher, as you suggested. This has obvious drawbacks. Most obviously, having to re-create an entire launcher applications is obviously difficult, and likely to create more issues than fixes. You could search out an open source launcher application, and attempt to add your feature to this, however you'd then be reliant on the purveyors of this codebase to accept your feature.
The second, and the way I'd recommend, to access this information is through accessibility services. This information is available to services like TalkBack. It is essential to how they function. The difficulties you'll face here are interacting properly with the numerous launchers available out there. However, most of these launchers are based off of a similar starting point, which is the Android base open source launcher. As such, the portions of the launcher that you care to interact with should be coded very similarly in most launcher examples.
The downside to this approach is that only one accessibility service can be active on a device at a time. So, users who are partially blind, who may want to use your feature and TalkBack at the same time, won't be able to. It is of course to you to determine which set of difficulties/benefits you'd prefer to deal with, but these are your options.

Android: How to access display (Activity) of different app that is not shown in upper layer

Hello Android developers,
Im more or less expierenced in Android programming and now i want to create an app that is allowed to access the display of another app or the activity that is less my app. Both apps should be active, should run. My app shall access the display data of the other app (also can be android system display), change it a bit and then show it again.
Is it possible without root rights?
Is there any Android support class that could help me? Which way i can go?
I hope my problem is clear and you can help me!
Ok now I have a more detailed question: How can open my app and show a transparent RelativeLayout, so that you can see what is below my app?
Thankyou a lot
Martin
If both applications are yours, you can access the other Activity using a connection between them (sockets, pipes, shared files, etc.)
If you'd like to create an overlay and display something on top of the other app, you can do that using a 'system window' popup. For example: Popup window in any app
If the other app is an arbitrary software without any modifications, such thing is not possible as it would lead to security issues. Both applications are Unix processes running in their own sandboxes without any direct communication.

Can an Android app interact with another app?

I want to be able to tap the statusbar and the contents in the displayed app to be scrolled up to the top.
Is it technically possible that an app intercept my tap and send the appropriate command to the active app? I have noticed for example that AntTek quick settings shows a drop-down window when swiping down from statusbar. While using the app I did also notice that even by just tapping the statusbar (before beginning to move the finger down), the app seems to already interact with the touch as it dims the screen brightness in preparation to display it's "window" (sorry I use the MS Windows term), so clearly a statusbar tap CAN be sensed by an app.
Starting from this, I wonder if such an app could then send a message to the active program telling it to scroll up.
Is that possible? And if yes, the message must be customized to a particular app (let's say the browser as the most important) or is it standardized so the apps speak the same language between themselves?
I am not a programmer so answers with codesamples might be less helpful than a plain english explanation. Finding out that is possible would lead rather to pursuing a programmer to implement the idea rather than starting to develop it myself.
Thanks :-)
There is an XPosed-module which seems to do exactly what you want.
To use XPosed-modules, you'll need to root your phone and install the XPosed-framework.
The XPosed-module is called "Statusbar Scroll to Top" and its repository can be found here:
http://repo.xposed.info/module/com.mohammadag.statusbarscrolltotop
This will work for almost all app-lists, but for example won't work for browser-content.
If you want to scroll to the top of the page in a browser, then you'll probably do best to get a browser which can do that on its own. (For example Habit Browser has it built-in and respective plugins are available for Firefox.)
Yes it is possible. HiroMacro and Frep can do this, but it requires root. https://play.google.com/store/apps/details?id=com.prohiro.macro&hl=en
(how do they simulate mouse and keyboard interactions on other applications? i have no clue :/ anyone?)
Is it technically possible that an app intercept my tap and send the appropriate command to the active app?
No. One app cannot send fake input to another app, for security reasons.
An android app comprises of several activities. Each activity display a GUI that allows the user to perform a specific task. To take the user from one activity to another, app must use an Intent to define our app’s intent to do something.
An intent can be explicit in order to start a specific component (a specific Activity instance) or implicit in order to start any component that can handle the intended action.
Interacting one app to other app in android
google docs link

how to permanently override android soft keys behaviour and display through

I am relatively new to android and want to create an application that permanently overrides androids basic softkey behaviour and view (for devices with soft keys).
Some functionalities I want to implement are changing the size of the softkeys window at the bottom, change its images, and possibly change its functionality.
For example, the user can set the size to of the softkey to be "large", "medium" or "small". And I can change the functionality of the back button to open say a particular application instead of going "back".
I'm basically looking for a high level answer as to how to do this, a basic direction of what I should read/study in order to be able to accomplish this. I realise this may require root access.
Please note that I want this behaviour to change not only in my application but I want the effect to exist on all applications. If this requires the application to be running atleast at the backend, that is fine.
After doing some decent amount of search, it seems I will have to make changes in the systemUI.apk, or possibly get its source code and modify it. Is this correct?
Thanks in advance.
I don't think even root is going to be enough for the type of changes you are describing. You're going to need to edit the Android source code and build your own system image.
Well you can't override system resources because they are part of the system image.
What you are looking for is called Home Application which can be developed like any other android app no need for root , you can find an example for it in your sdk samples.
Home Sample Application.
your app would be responsible to have UI components to send the user to all of the phone functionalities which includes:
Place for wegits
Place for apps listing (menue)
Access telephony functionality (call, phone history ...)
Access settings.

modify a an existing Android ROM to control user actions

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.

Categories

Resources