I am developing an Android application that could manage the applications installed on your phone without root permissions.
I have already completed most of the features but I am stuck on one feature.
I have to hide a specific application that the user chooses from the Menu.I cannot achieve that however I try.
I already tried
PackageManager p = getPackageManager();
p.setApplicationEnabledSetting(packageNameOfApp, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
But I am getting a permission denied error... How can i over come this please Help
This is my Manifest Permissions
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE" />
I have already tried adding
android:sharedUserId="android.uid.system"
tag to Manifest but givesout error that looks like this
INSTALL_FAILED_SHARED_USER_INCOMPATIBLE
I am sorry for posting such as long question but i was trying to be as detailed as possible.
Any help would be greatly appreciated.
Thanks
Take a look at the android manifest permissions documentation for the CHANGE_COMPONENT_ENABLED_STATE flag, and note the following phrase:
Not for use by third-party applications.
As far as I can imagine, sharing the system user ID would violate most of the security that the OS provides.
There is another solution: you've likely used launcher applications (Apex, Nova Launcher) that run in place of the OEM/Google launcher. These applications provide their own applications list, and allow hiding of apps without disabling them. It's clear that this is not what you're trying to do, but creating a custom launcher and maintaining your own app list may be the closest you can get without root.
Related
I'm trying to find out how to achieve the following:
The people in the chat hinted that it may be a system-app setting, but that was as far as I could get.
Even being a system-app setting I cannot find it anywhere, so what do I need to do in order for my app to be able to do the same thing?
Before anyone comes with comments stating how user-unfriendly this is and not to do it, this is not for a generic app but for a business centered work environment where it is important to ensure the notifications are not turned off, especially when the devices can be passed onto other colleagues between shifts and one of them could've turned something off and the others are not aware of.
As it seems this is only possible with system apps or at least with apps that have special access - which is not available to apps normally installed from the PlayStore or similar.
You can specify which app features your app requires. Such that if they turn off the feature, or don't have the feature, the app won't run. In the manifest file you would declare something like:
<uses-feature android:name="android.hardware.telephony" android:required="true" />
<uses-permission android:name= "android.permission.RECEIVE_WAP_PUSH" />
In your app, you would need to check if the user has granted the permission to RECEIVE_WAP_PUSH and if not, display an error message and force them to exit the app.
After review, we found that your app does not qualify for use of the requested permissions. In your permissions declaration form, you had indicated that your app is a default handler; however, we were unable to detect that capability in your app’s manifest.
i had developed a app which can help in emergency so am using below permission
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CALL_PHONE" />
i am using call_phone to call directly 100 and other emergency numbers
and send_sms to send direct sms to particular contacts.
while publishing they asked me core functionality
i had tick
default sms
default phone .. tick on first version
second version i have tick
deafaut sms
default phone
safety alert- emergency senior
both the time it got rejects saying same message.
please help me how to overcome rejection again and again
It is impossible to tell what you entered wrongfully - while a) not knowing what you've entered there (especially permissions SEND_SMS and CALL_PHONE might be problematic), as well as not having seen the app. an app not being a default handler generally means, that there might be an intent-filter missing in the Manifest.xml, which would enable it to be selected as the default handler for one or several intents. if you don't have one, you need to correct the submission form.
See this article on the Android Developers blog, which explains the permission problem you're facing.
The issue with old people is, that they barely can handle a smartphone - especially in case of emergency. there are phones with huge buttons, which have an additional ICE button in the back, which does just that - and while still remembering the button, this is far more reliable than having to unlock a smartphone. ICE means in case of emergency ...demanding technical understanding in such a situation, that can indeed be life threatening; just consider a stoke - which phone do you think is more likely to provide emergency services on time?
On Android, I'd rather suggest to set up the system default "ICE Information", if there are any medical conditions, which first-responders should be aware of, alike: medications, allergies, etc. This information is accessible without having to unlock the phone; just alike emergency calls.
I am trying to use "android.permission.PACKAGE_USAGE_STATS" in my app. Here it says that NOTE: This API requires the permission android.permission.PACKAGE_USAGE_STATS, which is a system-level permission and will not be granted to third-party apps. However, declaring the permission implies intention to use the API and the user of the device can grant permission through the Settings application.
It seems that I will need the user to explicitly give my app the permission to give access to the access the usage stats.
In addition, I used the intent code below to open the screen to allow user to give access to my app, but my app is not in the list.
Code I used:
Intent intent = new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS);
startActivity(intent);
When *startActivity(intent)' is fired (or going to *Settings>Security>Apps with Usage Access), a blank screen below pops up, my app is not part of it.
Bottom line question is -- How to use UsageStatsManager in Android Lollipop? Anyone tried it?
This is what worked for me.
<uses-permission xmlns:tools="http://schemas.android.com/tools"
android:name="android.permission.PACKAGE_USAGE_STATS"
tools:ignore="ProtectedPermissions" />
You can simply make this on the manifest, ignoring just this permission error:
<uses-permission
android:name="android.permission.PACKAGE_USAGE_STATS"
tools:ignore="ProtectedPermissions"/>
The AndroidManifest.xml error can be fixed by disabling lint errors. Specifically
Security - SignatureorSystemPermissions
I guess after that the settings app will show your app.
How Do we find what level of Android protection is required for a specific permission.
Lets say we have android.permission.SET_ACTIVITY_WATCHER(docs)
What protection level does it fall into?(docs)
Regular
Dangerous
System or Signed
Signed
You can find some permission with there levels here:
https://github.com/android/platform_frameworks_base/blob/master/core/res/AndroidManifest.xml
and an other solution is the following code sample:
getPackageManager().getPermissionInfo(name, 0).protectionLevel
in you're case is this the infos:
<!-- Allows an application to watch and control how activities are
started globally in the system. Only for is in debugging
(usually the monkey command).
<p>Not for use by third-party applications. -->
<permission android:name="android.permission.SET_ACTIVITY_WATCHER"
android:label="#string/permlab_runSetActivityWatcher"
android:description="#string/permdesc_runSetActivityWatcher"
android:protectionLevel="signature" />
Usually Creators of respective API sets the permission depending who are the recipients of this API.
Best way is to grep the source code for the respective API permission.
Android document fairly states what is intended for 3rd party and what not. Permission is usually "Normal" for all things intended for Normal.
http://developer.android.com/reference/android/Manifest.permission.html#SET_ACTIVITY_WATCHER
To answer your permission question
https://android.googlesource.com/platform/frameworks/base/+/master/core/res/AndroidManifest.xml
Look at fragment .. it is signature permission.
Allows an application to watch and control how activities are
started globally in the system. Only for is in debugging
(usually the monkey command).
Not for use by third-party applications
permission android:name="android.permission.SET_ACTIVITY_WATCHER"
android:label="#string/permlab_runSetActivityWatcher"
android:description="#string/permdesc_runSetActivityWatcher"
android:protectionLevel="signature"
My application needs that GPS is active at startup as for it to proceed.
Iam testing the app, so I'm mocking the GPS by adding <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" /> to my AndroidManisfest.xml file.
This works ok. But I want to keep things separate. Is it possible to add a permission at runtime when we are testing?
EDIT:
I know from the docs that:
Android has no mechanism for granting permissions dynamically (at run-time) because it complicates the user experience to the detriment of security.
But as a matter of testing the application, is there an alternative?
Thanks
There is no way to add Android permissions at run-time. They must be specified in your manifest.
If you have a separate test application, I believe you only need to put this permission on your test application.
EDIT A test application is really no different to Android than a regular one in terms of permissions. I would just put the permission in your test application's manifest and not worry about it.