Why should I start urban services as a separate process?

I am using UrbanAirship (UA) for push notification.

The push UA service is configured in the manifest file as follows:

<service android:name="com.urbanairship.push.PushService" android:process=":com.urbanairship.push.process" /> 

Where android: the process is optional, but recommended in its documentation .

When I use a single process and close all my actions, I see that my only process consumes ~ 3 MB of memory

When I use two processes (one for the application and one for the service) and close all my actions, I see that both processes are alive, each consumes ~ 3 MB of memory.

So my question is: what's the point?

+4
source share
1 answer

I assume UA recommended this so that their own code comes across fewer conflicts / crashes. For example, if your application crashes, but the UA code runs in a separate process, then they can probably continue to work without interruptions (and to avoid possible data corruption that could occur if the process receiving them is suddenly killed).

For another hint, see this SO question: Running Android notification at startup . As you can see, some developers report that regular notifications for Android sometimes do not appear depending on the life cycle of application components. By placing UA PushService in a separate process, this can reduce this problem. I am going to check this because my UA notifications are sometimes not saved after a reboot.

By the way, it seems that the latest UA documentation no longer recommends declaring the Service as its own separate process.

+1
source

Source: https://habr.com/ru/post/1384308/


All Articles