Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android What is use of persistent?

Tags:

java

android

What is use of android:persistent="true" properties?

<application
    android:fullBackupContent="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:persistent="true"
    android:largeHeap="true"
    android:supportsRtl="true"
    android:theme="@style/AppTheme1">
</application>
like image 901
Alis Avatar asked Apr 27 '17 11:04

Alis


2 Answers

Unfortunately, for most developers there is no use. The official guide for android:persistent has a weakly worded comment that it is "intended" for system apps. To be clear, this property is ignored unless you are a system app.

You can see in the commit where flag checking was added to PackageManager, this requires both the persistent flag and the system app flag. If your app only has one of these, it will not be treated as persistent.

So this property is only useful for platform developers and hardware vendors. Sorry.

But what does it do? This property allows you to start a background service on Oreo and prevents it from being automatically killed.

like image 51
Brent K. Avatar answered Oct 08 '22 21:10

Brent K.


Read official guide line about android:persistent

Whether or not the application should remain running at all times — "true" if it should, and "false" if not. The default value is "false". Applications should not normally set this flag; persistence mode is intended only for certain system applications.

like image 43
IntelliJ Amiya Avatar answered Oct 08 '22 19:10

IntelliJ Amiya