Main activity release

NevaranNevaran ✭✭BGMember ✭✭
I got an app that starts a service when the phone boots and monitors various things.

My problem is that if the app itself, the memory usage jumps from 40mb or so to 300 or more, with 5 things running instead of 2.

Is there a way to release/close the activity alongside with the other processes?

Answers

  • robbitrobbit Xamurai CNMember Xamurai

    Hi, by Is there a way to release/close the activity, what do you mean? Do you want to release the memory used by the activity?

  • NevaranNevaran ✭✭ BGMember ✭✭

    @robbit said:
    Hi, by Is there a way to release/close the activity, what do you mean? Do you want to release the memory used by the activity?

    When the app is started via the boot receiver, it only has 1 process and 1 service, when its started via the app itself, after closing the app it leaves 4 processes and 1 service open.
    I need to close those 3 processes that are running alongside for no reason.

  • robbitrobbit Xamurai CNMember Xamurai

    How did you create the other 3 processes, by add android:process in your manifest? If so, you just need finish the Activity, or stop the service, or unregister the broadcast. I don't which way have you used to create the remote process, can you show me?

    Or can you show some pictures about your 4 processes and the service?

  • NevaranNevaran ✭✭ BGMember ✭✭

    @robbit said:
    How did you create the other 3 processes, by add android:process in your manifest? If so, you just need finish the Activity, or stop the service, or unregister the broadcast. I don't which way have you used to create the remote process, can you show me?

    Or can you show some pictures about your 4 processes and the service?

    I believe they are created from the ads gsm, though the process that stays even without the ads loaded has more than twice the memory used than when the service is started via boot

  • robbitrobbit Xamurai CNMember Xamurai

    Ok, if the process is created by third part lib, you can use this, if the process created by your app, kill them as I have said above.

    Please open your phone's setting, find the running process, and check their package, screen shot, and then post it.

    The pictures can help me to analysis.

  • NevaranNevaran ✭✭ BGMember ✭✭

    @robbit said:
    Ok, if the process is created by third part lib, you can use this, if the process created by your app, kill them as I have said above.

    Please open your phone's setting, find the running process, and check their package, screen shot, and then post it.

    The pictures can help me to analysis.

    Heres a ss from the dev options

  • robbitrobbit Xamurai CNMember Xamurai
    edited July 2018

    These are normal process.

  • NevaranNevaran ✭✭ BGMember ✭✭

    @robbit said:
    These are normal process.

    How come normal? I cant find a way to close them and they are shown only if I open and then close the app instead of a boot launch.
    There **must **be a way to close/end them after the app has been closed and left only the service running

  • robbitrobbit Xamurai CNMember Xamurai

    Ok, can you show what third part lib have you referenced in your project?

  • NevaranNevaran ✭✭ BGMember ✭✭

    @robbit said:
    Ok, can you show what third part lib have you referenced in your project?

    MainActivity:
    using Android.App; using Android.Content; using Android.Content.PM; using Android.Gms.Ads; using Android.OS; using Android.Support.V7.App; using Android.Views; using Android.Widget; using System;

    Service:
    using Android.App; using Android.Content; using Android.Graphics; using Android.Graphics.Drawables; using Android.Net; using Android.OS; using System; using System.Threading.Tasks; using Android.Net.Wifi;

  • robbitrobbit Xamurai CNMember Xamurai

    You can use ActivityManagerService.killBackgroundProcesses.

  • NevaranNevaran ✭✭ BGMember ✭✭

    @robbit said:
    You can use ActivityManagerService.killBackgroundProcesses.

    Will try it when I get the chance, thanks

  • NevaranNevaran ✭✭ BGMember ✭✭

    @robbit said:
    You can use ActivityManagerService.killBackgroundProcesses.

    Does not seem to do anything.

    Must I write the string inside which process i want to kill for example like this: com.android.chrome:sandboxed_process0 ?

Sign In or Register to comment.