Single application custom Android ROM - java

I find this question a couple places on the web, but never with a good answer. Let me be specific in the questions asked.
I want to build a custom Android ROM which only features one app. This app is not to interact with any hardware (per now). This app will be launched on the start up of the device. No locked-screen. The device will have to restart if the app malfunctions.
A resource told me that you can change the launcher app of the ROM.
-> Does this mean that the home screen, the one which displays all apps on our phones, is merely another app? If so, can you simply change the launcher app as it is stated here? What were to happen if this app fails?
If this is the case, it would solve the entire issue.
If not, how do you go about making this sort of project? It includes
Making an app on AOSP
Refuse users to leave the app or interact with anything else
Making this app part of the boot-up process
Remove locked screen
Make the app a dependency of the OS (to force shutdown if malfunction)
Thanks in advance for any replies

I just found Android have a topic about dedicated devices (formerly called corporate-owned single-use, or COSU) are a subset of company-owned devices that serve a specific purpose. maybe that can meet your requirement.
BTW, After into the sub-topic lock task mode that mentions about set DPC whitelist APPs and the device policy controller (DPC) needs setup by other steps.... FYR~

Related

Screenshot of the device screen Android from service

I am working on an Android application This application is a parental advisor application and it will be installed on the parents' phone and on the child's phone.
My question is how will the screenshot be taken from the boy's phone without his knowledge?
thats pretty high privilege, which need special permissions. you probably have to create AccessibilityService, but be aware, that Google Play may refuse your app from publish in their store. btw. you can't start this Service from the code, user must enable it in system Settings

Creating a background service for a finished app

I am fairly new to android development, and I want to customize an open source browser application to suite my usecase.
So what is my usecase:
I use an Oculus Quest 2 running Android. As with any Android device, you can sideload any app on it, but unfortunately the OS is very rigorous with killing background tasks, making it impossible to have Discord or Spotify running in the background while playing a game, which was my plan.
So I thought about it and came up with the idea of creating my own browser that implements the functionality to prevent it from being killed by the OS itself, and then in the browser I can open the web application of Spotify or Discord or any other web service to listen to it.
I have now decided to use the FOSS browser which I found on github and wanted to modify it to keep it open in the background. Unfortunately, I know next to nothing about Android app development and I don't even know if it's even possible to add this kind of functionality to an existing app without completely rewriting it. I hope my explanation is clear and that there is someone who can help me with this task.
Some keywords I already found out about are:
creating a service (background service)
foregrounding -> to tell the system that the app is important to the user and shall only be closed if memory is very limited
There is already one app out there which is able to run in the background of the oculus quest, so there is definitly a way of perfoming this task but unfortunatly I dont know how... yet

How can I force touch events on none routed Android devices

I would like to write an application which can programatically generate touch events on the phone.
I have already tried this methods:
adb : adb swipe and so on... It requires USB cable and connect the phone to pc
adb ON TCPIP: same
My problem with adb is to require so much presetting by user and I don't want to make the user to learn it. I have already made an application which use adb, but it's difficult for the user to set up properly :(
I have heard and I tried to sign my application with platform sign, but it's not good for me, because I would like to publish my app on android market and it is not a system application...
I would like to find a way to achieve this in a single application which can produce touch outside of the app (from background) and I would like to publish on market.
I have found this application: https://play.google.com/store/apps/details?id=com.teamviewer.quicksupport.samsung which can basically do this. Because when I click on my computer, it send a message to the phone and the phone make the touch on the screen. How and with what privileges can teamviewer do it?
Please give me some advice about it.
I would like to find a way to achieve this in a single application which can produce touch outside of the app (from background) and I would like to publish on market.
This is not possible, outside of what little input faking can be done by an accessibility service.
How and with what privileges can teamviewer do it?
If your read that Play Store listing, you will notice that it only works with Samsung devices. That is because the makers of TeamViewer struck a deal with Samsung to enable this sort of integration. Similarly, the TeamViewer team struck deals with a few other device manufacturers. However, they did not do so with all manufacturers, and so TeamViewer does not work on all devices.
Have a look here .This might be useful.
InputInjector
Android library that eases the process of injecting InputEvents (MotionEvent, KeyEvent) to you Android app. The library uses internal API calls to inject events and depend on the accessability of these. This library will therefore not work on all devices but theoretically support Android 2.3 and forward (API level 9-18+).
Androd 2.3 (API level 9-15)
In older versions of Android we envoke the same system calls as used by the Instrumentation framework.
Permission No special permission needs to be set.
Androd 4.1.2 (API level 16 and forward)
As of API level 16 we have access to the InputManager class. We use this as the basis for the input injection.
Permission Using InputManager for injection requires setting permission android.permission.INJECT_EVENTS in your manifest.
Using this permission may require altering Lint Error Checking in order to be able to compile. In Eclipse this is done by going to Window->Preferences->Android->Lint Error Checking and then finding ProtectedPermissions and setting severity to something else than error.
NOTE: In order to inject events to other apps using InputManager, your apk must be signed with system level certificate.
https://github.com/arnebp/android-inputinjector

How do "add-ons" work for native apps?

I am designing an app for Android, iPhone/iPad and Windows Phone using GWT and PhoneGap. GWT will allow me to write the entire app in Java (my strong suit, unlike JavaScript or CSS) and will translate it into cross-browser JavaScript/AJAX. PhoneGap will then wrap that resultant JavaScript and turn it into a native app for each of the three platforms mentioned above.
I would like to have a "plugin-oriented architecture", whereby users can optionally purchase (or qualify for through other means) "add-ons" (plugins/extensions) that will enhance the functionality of the app.
Normally I would accomplish this by using the Java Simple Plugin Framework (JSPF) and allow users to download plugin JARs as they paid for them. These plugin JARs would then be added to the classpath of the main app so that the next time it starts and scans the classpath for plugins, it finds them and loads them.
Is this possible with native apps? I don't believe I can deploy anything other than APK, IPA and XAP (Android, iPhone and WinPhone respectively) files to these marketplaces.
In Java-land, this would be like having to download a "base" app in the form of an executable JAR (containing its own main method), and then having to download a "plugin" app that is also an exectuable JAR, and somehow get the two to behave like a normal plugin architecture (which would be if you have 1 exectuable JAR base app and then 1+ plugin non-executable JAR libs).
So I ask: how do add-ons work for native apps from a deployment/download perspective? How do you get 2 or more APKs/IPAs/XAPs to communicate with each other on the client-side? If not possible, how do native app developers handle add-ons (I know they exist, I've seen them!)? Thanks in advance!
as for iPhone - the only way is to implement the additional features and have them disabled until the user purchases in app to unlock the feature.
In Android you can have apps communicate with each other so that the user can just load add-on apps that provide only the add-on functionality. For more detail on this.. android communication between two applications
WP8 - I do not yet have experience
Although I am not a core Android Developer, here are some suggestions from my experience with Android till now:
One possible solution for Android is to use Updates for application. One way to achieve this is using a Background Service which checks for updates whenever app starts or use GCM (Google Cloud Messaging) to push update messages to the app. Second option is much better as you can provide instant update to the user ,on per device basis (a user can have multiple devices), as soon as he/she has bought your add on feature. After the user has got the update message you can download the whole app with new feature and update app on the device. Of course in this case you need to backup the existing data of the app and restore after installation of updated app.
I don't know if this thing can be done but it would be also be an good option in my opinion if you can provide a legitimate user, who have bought the particular add on, an updated app through Android Market.
Another way is to create each add on as a Service and then let the main app can detect (or bind) those services at startup and if they are available, your app can communicate with them easily. You can even call the UI portion of the newly deployed add on from your main app by using Intents and BroadcastReceivers.
You may also find this useful as far as Android is concerned:
However, there are ways for an application to share data with other
applications and for an application to access system services:
It's possible to arrange for two applications to share the same Linux
user ID, in which case they are able to access each other's files. To
conserve system resources, applications with the same user ID can also
arrange to run in the same Linux process and share the same VM (the
applications must also be signed with the same certificate).
Hope this gives some useful information to you.

Block an android device

I'm developing an app for Android Tablet PC and I need to allow user to run only exact applications.
1. Is there any way to deny other applications execution?
2. Is it possible to show some block screen with password prompt and deny user to run anything until the authentication will be passed?
Unfortunately I haven't find any info :(
If you're talking applications (and not just activities within an application) then it would not be "safe" for google to allow you to block other programs from running. If you had your own (non-stock) version of Android that you were deploying on company devices for example, then perhaps you could do that, but if you're just making an app, it would not be wise to have an app prevent other ones from running. You could perhaps set up some kind of shared memory resource with some flags that other apps could look at upon launching to see if they should proceed or not, but that is about it.
You would have to write a replacement for the launcher & app drawer so that you can manage the application launch process. There is a demo for creating a launcher in the SDK, and a short thread about it here

Categories