I found this from other answer
Runtime.getRuntime().exec("pm clear PACKAGE_NAME");
but this is working for own app only, i can not clear data of other app using this.
Will this work after converting my app as system app?
Do we have any official link on how to create system app and test it?
It cannot be done without Root Permissions for oblivious security reasons.
System Apps can execute few actions more than User Apps however they don't have access to other folders.
Imagine an App that could clear all 3rd App's data...it could be very dangerous.
Related
The idea is that we want to process these images, videos, audio recordings for security requirements at a server BEFORE releasing them back to the user
I seriously doubt that this can be achieved via any legal way.
You want to collect all user data which are not even created using your app.
If a user grants the permission to your app then "Yes".
Your app can have the permissions accordingly which the user needs to agree before installing the app.
Your app now has access to images/video/sounds from user machine and you can sync it back to your server.
I personally will not install any such app.
On Android, no, you cannot do this. Through device admin APIs, you can enact policies that block the camera from use (I don't recall an equivalent option for the microphone). But given that the camera and microphone are available to apps, you have no way of intercepting them, processing them, and somehow seamlessly getting that data back to the apps that had requested the microphone and camera. Similarly, you have no guaranteed way of getting at "recordings", for the simple reason that these apps do not have to create files at all, let alone ones that you have access to.
You are welcome to create a custom ROM that contains this ..."feature"... and try to convince users to replace their Android installation with your ROM.
How to check if the app is a fresh installation or a re installation. I want the user to have his history downloaded if its a re-installation like whats app. I thought of writing the user id in the shared preference but that is not possible as the data may get erased once the app is uninstalled. I am already having a folder of my app on the device which is used for image caching and downloading new images, but this is not reliable as the user may delete the folder. What else can I try ???
Obtain the user storage with getExternStorage, then leave a file there that specifies the usage history. The file you save there will survive uninstalls and reinstalls. Of course the user can delete that file but generally they will not, and if you name it properly they will realize it is part of a program.
I'd suggest you integrate with Android's Backup Service.
People switch phone every two years. Some factory reset their device. Some have more than one device. And some share their device with their kids. Linking a user history so that it follows a particular google account is the ideal way to go.
As to your question regarding Facebook integration, I'm afraid I know too little about that topic to be of any help.
How can I skip the "are you sure" dialog while uninstalling an android app from another app?
I guess that is not possible due to android security policy. And that policies have reasons to be there.
Otherwise every app would be able to uninstall another one causing troubles to the users if that operation is performed by a rogue app.
You have no control over other apps as far as install/uninstall, basic Android security.
The best you can do is have your app check for the existence of the app you are concerned about your students using and not letting your app run if it is present.
Then it is up to the student. They have the choice to uninstall said app to allow yours to run, or not run your app.
Let's say I have an app which does something (exactly what is irrelevant, as this is a very generic question), and I want other third-party developers to be able to expand the functionality of my application through an add-on like system. Just to give you an example of what I mean, I might develop an SMS app for which someone else could add support for Facebook chat, AIM etc. Is this possible, and if so, how would you go about doing this?
I'm pretty sure this isn't allowed due to it would allow a 3rd party to circumvent the permission system in Android. If could get an App to load code not shipped with it then they could get elevated permissions without the user knowing. Even if you had to request permissions when installing the 3rd party plugin those permissions don't have to include the permissions of the App you are augmenting. Therefore, if that code got loaded into the same process as the App it would be allowed to execute at the level of permissions the orignal App had instead of the ones it presented to the user.
Therefore, your only option is to leverage intents, but intents don't have to invoke Activites. You could build a service, or broadcast method to do some processing and give back the results to the original activity. Read up on them and see if you can leverage them. Android's system is a system of collaborating applications not plugins.
http://developer.android.com/guide/topics/intents/intents-filters.html
I should probably add that what I would want is not to call an activity from another application to do its stuff, but rather to integrate the functionality of another application into my own activities somehow.
If "functionality" is "UI", that is generally not possible, outside of RemoteViews (the same tech used for app widgets).
If "functionality" is anything else, follow chubbard's answer -- the plugin can expose an API to you and/or you can expose an API to it.
Integrating the functionality may look a bit different than what you expect. You can leverage the functionality of another application into your own by using an intent to start an activity in the other application. Let's say that your app is app A and all the others on the device
are the set of apps : you have to hope that some app in can accept an intent and do what you want. If you want data back, then in addition you have to hope for that functionality as well. If permissions are involved, you have to hope that the application is set up for that as well.
This is always the challenge with cooperation between apps: they all have to have the API for cooperation.
So, the best approach is to use an intent.
What is the best way to prevent a user from downloading and installing applications which uses some specific permissions like location and sms.
Is it programatically possible to parse the manifest of an application from the market before it get installed and look for the specific permissions and alert the user?
What is the best way to prevent a user from downloading and installing applications which uses some specific permissions like location and sms.
Write your own firmware, where you replace the normal installer mechanism with one that enforces your desired criteria.
Android SDK applications cannot interfere with application installation.
Is it programatically possible to parse the manifest of an application from the market before it get installed and look for the specific permissions and alert the user?
No, sorry.
However, you can listen for ACTION_PACKAGE_ADDED and examine the newly-installed package via PackageManager, and alert the user at that point. Since nothing of the installed package can run immediately upon the install, I would think that there is a decent chance that your alert will appear before the user tries to use the newly-installed app.
In the future this would be probably something you could do trough Device Administration, but right now limiting application installation based on its requested permission is not included.
One option is this snippet that decompress the apk and extracts the AndroidManifest.xml.
By the way the aapt tool for android runs on the Android OS too. You can get this information using this port