OS Library: killProcess/killBackgroundProcesses not working

Arun

Member
Licensed User
Longtime User
Hi!

I have started a 3rd party app directly (Angry Birds Rio)

I want to stop the app from my program for which I am using killProcess/killBackgroundProcesses. When this runs, the app (ABR) restarts.

I have changed the manifest file also.

B4X:
Sub Activity_Create(FirstTime As Boolean)
   Dim OS As OperatingSystem
   OS.Initialize("OS")
   Dim lstname,lstpid, lstnamepid, lstret As List
   lstname.Initialize
   lstpid.Initialize
   lstnamepid.Initialize
   lstret=OS.RunningAppProcessInfo(lstname,lstpid,lstnamepid)
   Dim i  As Int
   For i = 0 To lstname.Size - 1
'      Msgbox (lstname.Get(i),lstpid.Get(i))
      If lstname.Get(i) = "com.rovio.angrybirdsrio" Then
'         OS.killBackgroundProcesses(lstname.Get(i))
         OS.killProcess(lstpid.Get(i))
'         Msgbox ("Kill process: " & lstname.Get(i),lstpid.Get(i))
      End If
   Next
   OS.killProcess(OS.myPid)
End Sub

This is the manifest file:

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14"/>
<supports-screens android:largeScreens="true" 
    android:normalScreens="true" 
    android:smallScreens="true" 
    android:anyDensity="true"/>
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/>
)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.
What am I doing wrong? Or have I not understood the above concepts correctly?

What do I do to stop/kill a 3rd party app from my program? Or at least prevent it from restarting? I have seen the kiosk tut, but I want to end 3rd party apps from my program.

Thanks in advance

Arun
 
Top