When a user tries to launch an application I want to suppress that application and then call another application. Example I want the user to authenticate himself before launching a particular system application (settings application etc). The authentication application should pop up every time the user launches the settings application
I know you will have to use broadcast receivers and intents but have no clue how to do it.
Sounds like you should create a "lib" project that have public interfaces that you can use.
Then share them between the apps instead of trying to execute another app?
But what I know this is not possible to actually execute up another app, since this then gives dependency to something that you don't know if it is installed. It must already been started if the intents should work.
Also like the answer before, it could be used for abuse.
Look at this link for more information:
http://mylifewithandroid.blogspot.com/2007/12/playing-with-intents.html
I sort of hope this isn't possible... Launching a different application from the one the user actually clicked? Leaves the door open for abuse.
Related
New here. I still didn't decide which technology I'll use to make this app, but the main feature is basically this:
There's app A and app B (I don't own any of these);
My app (C) needs only one role: when I login on app A it'll logout on app B and when I login on app B it'll logout on app A.
Note: Forcing app A or B to close will not logout or in.
Anyone knows a way to develop this? The app is supposed to be available on Android and iOS, I was planning to use nativescript.
Any help will be appreciated! Thanks,
Diogo
Unfortunately not because every app run in its specific sand box for security reasons. The only way to do something like that it is using broadcasts intents but the apps A and B should already be prepared to respond to a intent to log out and send a broadcast when log in. Probably it doesn't happen.
In iOS, this won't happen as every app is running on different sandbox and there is no relation between two sandboxes.
Thank you for all your answers. Very useful. Can I use an app to close and open others? For example, If I open Spotify it automatically closes YouTube music using my app. This way would only have to do with the smartphone or tablet.
Suppose I quit an app, say Amazon. How can I fire up an intent or view right after it closes?
I also want the app name or package Name which was closed..
For example, the way truecaller does it. It opens a view right after you call someone..
There is no possibility to do that - it is rather insecure from users perspective.
TrueCaller is listening on PHONE_STATE event.
If you want to implement this, You need to get a list of all installed apps and check if each app is running or not and then do your logic. And you can't compare your state with a truecaller. Cause truecaller is using a broadcast receiver which is an Android component which allows you to register for system or application events.
And to fully understand the ability to know when an app shuts down check this answer
I am developing an app where I have to lock some android default Apps such as messaging, email, gtalk, etc .
How to do it, i have no idea. Please help me with some relevant code or link .
What do you mean by lock? If you mean "prevent access unless user types a PIN/password" then you simply cannot do it without root.
The only non-root idea I can come up with is to write a custom launcher, that will hide the target applications, but this doesn't stop other ways to access them [recent apps, intents...].
What is your theat model?
Just wanted to know is there a way to protect an application from getting uninstalled. I know it's possible if i add the application as a device administrator but this is not enough.
Is there a way I could pop up a message asking for the security code before un-installation starts ? any ideas highly appreciated.
You can create two applications. The first will be you application and the second will listen for remove intents and will triger an action if your first applications is removed, but this is only a basic protection since the user can remove the second application first.
The only possible solution is to modify the android source. As there are applications that can't be removed (gmail, contacts, telefon app, sms app, facebook, twitter) there must be a flag that you can use for your requirement. But I doubt that there is a way on a non customized android os...
I think it's impossible If application is installed by user.
Application can be uninstall by user too.
I think "application protection" on the market do what you want.
Try to implement an BroadCastReceiver listen ACTION_PACKAGE_REMOVED.
We want to use Android mobile for dedicated application. Can somebody suggest how can we make it happen.
Here are the requirement:
The phone when started, should launch our application., so the user cannot launch any other application. The application will be a 1D barcode reader.
The application should be live as long as the phone is up and running, user cannot close the application at all.
Thanks for your help.
Regards,
Manish
Android after boot is complete sends a bradcast intent:
android.intent.action.BOOT_COMPLETED
if you listen for this intent, you can launch a service that in turn launch your activity.
In the Activity you have to take care of the user's interactions that explicitly close the activity, like home button, back button and camera button press.
Setting your activity to be full-screen also should prevent the user to use the notification bar to interact with notification like those from market-app that can close your activity.
Finally, your activity can be killed by the system by various and uncatchable reasons: in those cases, the service that first launched your Activity comes in handy, as it can periodically monitor the general state of the application and relaunch components as needed.
Check out the new Android Enterprise solutions for your use case.
https://developers.google.com/android/work/overview
Its well documented. You can either use
Android Management API to provision the devices and apply policies to the device which will be applied to the device using Android's Device Policy Controller (DPC) or,
Use Google Play EMM API and develop your custom DPC
It depends upon your use-case really, but the first solution set should serve your purpose
I'm afraid there's no single answer to this, but you need to work on multiple fronts.
One of these fronts is preventing user from running other applications: for this there are applications sold on Android Market that can put other apps of your choosing behind passcode.
You need to combine this with automatic launch, but I don't yet know how to do that.