-1

hi everybody

i need some help please does anyone know how can i put this in my manifest tag in androidmanifest.xml file:

android:sharedUserId="android.uid.system"

==>because when i do the deployment failed .

and how can i use this permission :

<uses-permission android:name="android.permission.FORCE_STOP_PACKAGES" />

==>because xamarin studio tell me it's a unknown permission

to use this:

ActivityManager am = (ActivityManager)GetSystemService (Context.ActivityService);
am.forceStopPackage(PACKAGE_NAME);

_Any help will be appreciated _

user3560028
  • 11
  • 1
  • 5

2 Answers2

3

Setting the sharedUserId to android.id.system actually means declaring your app to belong to the system. You cannot do that unless your app is actually signed with the system certificate. In order to get that certificate, you would have to negotiate with the manufacturer of the device. The only possibility you would actually be able to get the system key is running a firmware on your device that you built and signed yourself.

ActivityManager.forceStopPackage() is reserved for system applications and there is no chance to use it in a user-space application.

You can find various explanations on the Internet and on SO, e.g. here: Android Permission Denial: forceStopPackage()

Community
  • 1
  • 1
FD_
  • 12,947
  • 4
  • 35
  • 62
  • thank you for the quick response but how does any antivirus/ booster application from the Google play does to close all application and if ActivityManager.forceStopPackage(); is reserved for system application why it's even shared what how can some people can use it – user3560028 May 13 '15 at 17:28
0

If your goal is to quite your app, I would direct you to this question: Is quitting an application frowned upon?

Which sums up how and why you might close your own application.

Actually terminating the application is near impossible, but sending it to the back ground or finishing all activities gets the similar effect of being gone from the screen. This is by design and is explained in the article

To close other applications is either a ROOT only or system specific. So your application could request root permission on android if available. Otherwise, I believe it is possible to negotiate a app with some root access through google play but I assume it is very complicated.

Community
  • 1
  • 1
Zach S.
  • 130
  • 1
  • 9