signatureOrSystem protection level in Android Studio - android

I am pretty new in Android Studio. I am trying to add a permission:
<uses-permission android:name="android.permission.CONTROL_LOCATION_UPDATES"/>
The problem I am facing is that apparently my app is NON system app. I read about the differences between system and NON system apps. However I didn't get to any solution.
My question is: How to sign an app by platform signature? Can anyone explain that please? And maybe explain why do I need to do that?
I know that my question might look very silly, but as I mentioned, I just started to use Android Studio so I am pretty new in all that and I need some help with silly things like this one.

My question is: How to sign an app by platform signature?
Build your own custom Android ROM. You will sign that platform, and you can then sign your app with the same signing key. Of course, you will only get this permission when your app is running on devices that, in turn, are running your custom ROM.
And maybe explain why do I need to do that?
Because you are trying to use a signature-level permission to control the OS. Approximately 1 in 50,000 Android developers need to do this, and usually only in conjunction with creating their own custom Android ROM.
IOW, to quote the documentation for this permission: "Not for use by third-party applications".

Related

Is it Possible to edit a third party app in Android studio?

My problem is there is a set of apps called good lock apps made by Samsung But they aren't supported by One UI core devices and some, not with android 11, So I would like to increase the API level of the application, add any android source code as well as somehow make it accessible by one UI core devices(By changing boolean).In Android studio, I tried the above but the code reverts back to the original, and am not able to run it, So can someone please say if the above is possible, if possible say how to proceed and if not please say what can be done alternatively, Thank you!
If it's a third party application, then the app would reside within data partition. And in any case you should be able to install the new version of a third party app unless you hold version number higher than the one present in the device.
While targeting SDK version higher than 25 make sure that you have REQUEST_INSTALL_PACKAGES to install a new application.
The other option is to uninstall the existing application (at your own risk), and reinstall the compiled version of the apk.
If you still face issues, please attach the logcat information while installing the apk, that could help us to look into the problem further.

Android APK device compatibility?

I have been trying to get an app install on my phone. Its compatibility page http://www.goqii.com/devices.html doesn't specify my phone.
I wanted to know how this compatibility is locked to specific phones.
Trying to reverse engineer the apk (using simple apktool), I thought about modifying the minimum/target sdk versions. These two strings show that the apk is already above the Android version on device (4.2.2 or 19)
android:minSdkVersion="12"
android:targetSdkVersion="14"
As this isn't the problem, I am thinking about how to make it work. Any ideas if this compatibility is set elsewhere? I don't see any hardware differences between the compatible phones and mine (a chinese make called Gionee).
I think you should look into uses-feature tag in the manifest. If you go through the doc:
The purpose of a declaration is to inform any external entity of the set of hardware and software features on which your application depends. The element offers a required attribute that lets you specify whether your application requires and cannot function without the declared feature, or whether it prefers to have the feature but can function without it.
So it could be NFC or Bluetooth LE or Camera etc which is required for app to run and developer has made required=true for those features in manifest.
If you're trying to download the app from the Play Store, it is very likely that the developer has defined filters on that app (http://developer.android.com/google/play/filters.html). These filters are not part of the Android Manifest and so, they cant be changed. This has been answered here already: How to restrict android app to specific device make?

Google Play install error - Missing shared library

I have an app with 100k~ downloads on Play, which I started to develop like a year ago. Back then, it had the default crappy android UI. A month ago, I decided to include the ActionbarSherlock+HoloEverywhere libraries, so it could provide a much better user experience, with the Holo UI. Here comes the problem.
I got a few user reports, that they cannot update, since Play is keep telling them, their device is incompatible with the app. NOTHING changed besides adding and using the above mentioned libraries, so their device SHOULD still be compatible with my app. Here is what I know, and tried so far, including reports from the most helpful user, who cooperates with me, and want to use the app.
his old device broke, so it got replaced, and he couldn't install the updated version
on the new device, he can't install the old versions, which he could on the old device
the mentioned device is an atab5 MTK6577
the minimum API level is currently 8 (Android 2.2)
my app requests the following permissions:
android.permission.ACCESS_FINE_LOCATION
android.permission.ACCESS_NETWORK_STATE
android.permission.INTERNET
the features the device has to got are the following:
android.hardware.LOCATION
android.hardware.location.GPS
android.hardware.TOUCHSCREEN
I found a nice tool (http://codekiem.com/2013/02/13/market-helper/) , which I asked the user to try if he can trick Play to install the app, he did, and the app finally installed
after the installation, he got a new error message, "Missing shared library", so he still couldn't run the app
after some research, I found that some device may not have proper Google Maps api, or something like that, but it can be fixed by adding Google Apis to the apk, by explicitly adding Google Api to the Build path
I sent him the newly compiled apk, the new error message is: "Application not installed"
the user has problem with more apps, not just mine, typically with apps that uses GPS, and I guess Google Maps too, so it may be a device fault
as a side-note, I am using standard MapActivity, not the ActionbarSherlock mapactivity, but since the problem is there for the old, non-holo version of the app too, it shouldn't matter
Is there any way for me, to solve the issue on my end? I dont really care, if he still won't be able to run another apps, if he can use mine. Of course, if all his problems would be solved, that is the best case, but my priority is, can I add something to my apk? Or, what is the problem here? A corrupted Google Maps?
Thanks in advance, cheers
after the installation, he got a new error message, "Missing shared library", so he still couldn't run the app
This will come from some <uses-library> element in your manifest.
but it can be fixed by adding Google Apis to the apk, by explicitly adding Google Api to the Build path
Um, no, that will not work.
Is there any way for me, to solve the issue on my end?
Other than by switching to something like OpenStreetMap, no.
A corrupted Google Maps?
More likely it is a device (or ROM mod) that has pirated versions of various Google apps, such as Google Maps, and therefore did not set up the Maps SDK add-on properly.

Modifying installed APKs on an android device

I'm experimenting with Android and I want to know if the following is possible: can I modify/patch an installed APP using another APP?
I know it's possible with root access, but I was wondering about non-rooted phones.
The only solution that comes to mind is the following:
-Create copy of original APK from data/app/ folder
-Patch/rebuild it
-Launch installation of the patched APK
The user would need to confirm the installation, but in theory it would work right? Any other tecniques that I haven't thought of?
In case you're wondering, I'm interested in injecting different strings and other resources into existing apps to provide translations or other modifications (ex: cheats in games), without changing the source of original apps.
You are right, you can do this on a device. Smali/Baksmali can be used on Android, also the apktool should be callable (I have only tried smali).
A year ago or so I have tried to use smali on a device and autopatch the source output. There was some information on the net (which I'm currently unable to find, sorry) but it was very limited, at least someone showed how to use smali/baksmali correctly. I have abandoned this approach because I'm not that good at java and the resources on a phone are rather limited.
Another approach I thought of was to offload the actual work to a server somewhere in the net. But this has its very own problem as you need to transfer the files, you may need the framework.apks, and so on.
This is interesting but hard stuff, you need to decode/parse/patch/rebuild apks and this has to be reliable. When you fail, the worst thing is that the users phone is broken (I wanted to modify critical system apks, bad idea ;)).
Better if the reinstall is seamless and for that you need: INSTALL_PACKAGES permission.
Now, INSTALL_PACKAGES android:protectionLevel is "signatureOrSystem" which means the app needs to be signed with the same certificate that was used to sign the system image.
Now to sign one's app with the same certificate as the one used to sign the system image might seem like a difficult if not impossible task since vendors may not be to willing to let other's use their certificate. Then again, some might want your app included in their system image. In any case it doesn't matter per sey since it's Android and Android has a ROM market.
Android ROMS are more and more synonymous with the general 'workings' or 'features' of Android. It is something that Android users come to expect. There are ROM manager apps available on the Android market that will list and install ROMs etc..
So in essense for an app to gain the INSTALL_PACKAGES permission one can make their own ROM, OR, work with the people who make ROMS and either have the app included with the ROM or use the certificate used to sign the ROM's system image to sign the app.
Again it is entirely possible that a vendor include the app in their "firmware" (system image). You would have to approach them.
:)
if both are your app use .content provider to share data between apps.and if other app is from another developer then you simply can't modify the app.

How does Android Market install application?

This is more like general knowledge to understanding Android Market. So, first and foremost, I am sorry I has to ask here. I search for quite a while and still don't understand it. So, here we go.
As far as my knowledge is concerned, packageInstaller does install applications on Android. It does ask for user permission before it carries out installation.
So my question is "Does android market use packageInstaller or it does installation by itself?"
If it does not, there are a few things that I am not clear about.
I am almost certain that permissions are extracted from AndroidManifest.xml file. Before downloading, how does Android Market knows what are permissions required from the app? (My guess is that Android Market Web-end has recorded permissions when apk is uploaded)
Android Market asks user to agree permissions before it downloads apk. If user agrees and downloads, installation is carried out straight away after downloading (i.e. without launching packageInstaller). How is that possible?
As a third party application, can any app does the same job as Android Market?
So, I think I can ask to some your questions.
Package installer is not used for installing applications from Android Market - it does installation by itself.
I do not know precisely but I think for the first question you are
right. Android Market knows about the permission that the app
requires. It also can simply parse the AndroidManifest file of the
application.
This is done with the help of GTalkService. You can read more here
about it.
In general case no. But yes, if your app is signed with the system
signature.

Categories

Resources