i'm developing an application that need to do certain operations right after the installation (mainly save some configuration parameters).
I want to know if it is possible, and how to do it.
And also, is possible to start the application immediately after the installation (i need to start a BroadCastReceiver)
Thanks,
Ivan
This is not possible. The user has to start the app manually. Once the app has started you can then sit on a boot broadcast (BOOT_COMPLETED) and start services in the background from then on, but the first time the app starts needs to be instigated manually.
Related
im making a app that observes for some apps that are runing or not and execute it if dont
i dont know how to oberserve other apps processes and how to start another app that wasnt maked by me.
all that i got for now is run it as system service.
another possibility is create a self app that restart it own when it crashes or be closed.
there is any way to do it ?
My cell is not rooted
For your question, you can learn the application sandbox.
https://source.android.com/security/app-sandbox
When the developer makes an application, they can define their intent filter and tt is some way to let another application invoke it.
You can uncompress .apk from another application and find out the file AndroidManifest.xml. And then you can try it.
But you can just control the part of door they open to you.
I have to work on a project Where I have to upload users' locations every 15 minutes. For that, I searched a lot and found Recurring work with PeriodicWorkRequest. But the problem is that the WorkManager might not work when the app is closed/killed per the answer given here. Then I found about Service in android.
So I want to know If I want to send users' locations every 15 min even when the app is killed then how to approach this?
If an application is Force Stopped, the OS cancel all the Job related to that application. This is not a WorkManager only problem. The OS interprets a Force Stop as an user request to the OS that they don't want this application to run anymore.
Even if you use JobScheduler or a Service, the application is gone. But a force stop should be a user decision.
Some OEMs have implemented in the past some changes to the Android OS so that a swipe out of an application from the launcher was interpreted as a force stop with all the negative effects on scheduled jobs. This is where the problems start.
WorkManager is this case has implemented some mitigation, but the application cannot do anything if it is force stopped till the user launch it again.
If have a problem with a specific OEMs, please open an issue on the Android issuetracker as this maybe a CDD violation. Google can contact the OEM and request that they fix the ROM. This is going to take time, in the meanwhile, you can take a look at sites like don't kill my app to understand what are the constraints on a specific device and use a library like autostarter to help the user to navigate to the right setting.
I want to create an application in Android that will show the devices list of applications and then allow the user to select which apps they want to be restricted access to for a certain period of time.
I am aware there is an Android Application named "AppBlock" but i don't know how this works.
You select the app, the period of time and then it doesn't allow you to open the app.
You cannot actually block start of another application.
The only way that I see it is possible: you need to save the list of applications Info in your app that need to be blocked with the time when it need to be blocked. Implement a service that runs "forever" and detects started applications.
Refer to this answer about how to do it. On each detection you should check if application present in your database and if the time now says it need to be blocked. If it is - close the application. Refer to this answer for learning how to do it.
That is global architecture I think you should follow.
To Build App Block u need the following things
1-Accessibity services (AS)2-Forground Services (FS)
BY AS you will be able to stop activity that you have in your bloker list
FS will alive your application context that help to find block app
I know it's not the best practice, but it is a requested feature (e.g. for business apps). When the App gets installed, I need to automatically place it on the home screen. I saw a lot of code on the internet, but all of the code only works on button click when the app starts. But I need to place a shortcut on the homescreen immediately after the app is installed and before the app starts. Is there a way I can achieve this?
PS: To make the question more clear: The app will be distributed without Google Play Store, so that's not an option.
Thanks for your help!
Best regards,
Robin
You can't run any code in your application before the user starts your application for first time during to restrictions since Android 3.1. Check this for more information
That's an optional feature of the Market app, not of the apps themselves. When designing an application , it does not receive a broadcast about itself being installed.
the first time the app launched can create it.
You can achieve that by creating a method in your main activity and call this method from oncreate and create a boolean variable andsave it in shared preferences
Basically, what I want to do is to close another app not created by me from my app. I haven't been able to find a solution but have learned that this is something many critizise as being a bad solution in general.
I do believe I have a good reason. What I want to do is to have an app that can recieve a file via PUSH OPP from another device that doesn't have an app installed on it. To be able to do this I have to disable the host-device's PUSH OPP application. I have to do this since I need to take over the default channel (12) for pushing files from the OS so that I have controll over the file-sending from the client. I can't use another channel since I can't have an app installed on the client and thus can't make it push the file via another channel. I know this probably is very bad practice but the device with the application will only be used for this specific application.
One way that seems to work is to manually disable the system's PUSH OPP application but this creates a hazzle when the user should install and use the app. They have to:
1. Install the app.
2. Every time they start the device they have to go into running applications and disable the standard PUSH OPP.
3. Run the app.
If I would be able to send a quit-command through my app to the native PUSH OPP app the default channel (12) would be freed up for me to use without the user having to go through step 2 every time. Is this even possible to do without root-access?
in your code, youcan use
system(“kill pid”);
get pid from /proc