Comments (9)
Why DPC needs to be running all the time?
DPC retrieves policies from server and applies them through DevicePolicyManager, it doesn't needed to be alive to enforce the policy. It can also register for all kinds of system broadcast in case it is interested in some particular events.
If you indeed want to make sure DPC to run all the time, you can consider to use service.startForground.
from android-testdpc.
@ming030890 on some ROMs, once DPC be killed, all static broadcasts become inactive state and cannot receive any broadcast, then DPC cannot pull policies from server.
Service.startForeground() not working.
from android-testdpc.
Hmm, so you are saying you can't fetch policy from server in the background?
You can consider using AlarmManager, JobScheduler to schedule the job.
Also, consider using GCM to request client syncing.
from android-testdpc.
Unfortunately, because these methods used to keep application alive in the past, many ROMs disable them when application be killed.
GCM? GCM is unreachable for us...
from android-testdpc.
@ming030890 Sadly, due to the problem of survival, I don't think DPC is a stable solution for real work situation, although we has been developing on it(Device Owner part) for nearly one year, from android 5.0 to android 7.0.
I think the biggest advantage of DevicePolicyManager
solution is that we don't need to cooperate with phone maker, but if the problem of survival can't solved, we have to do that. If we have to cooperate with phone maker, why don't we ask for higher permissions like system signature.
from android-testdpc.
Finally, we have to use some bad methods to keep DPC alive to fetch policies on time, that breaks user experience but there is no other way.
from android-testdpc.
@shizhx can you please tell me which methods did you use finally? Had the similar problem, stuck with foreground services, but they seem to be not reliable solution at all.
from android-testdpc.
@shizhx can you please tell me which methods did you use finally? Had the similar problem, stuck with foreground services, but they seem to be not reliable solution at all.
no solution yet, we finally give up and choose SDK provided by phone manufacturer :(
from android-testdpc.
@shizhx can I ask you a few questions about your DPC architecture?
- What mechanism do you use for periodic background tasks?
Now I am using AlarmManager
+ BroadcastReceiver
. And inside receiver I do http calls. Before I tried to use Service
but it can't be started when app is at background (https://stackoverflow.com/questions/45016174/android-o-and-background-limits-prevents-simple-alarm-notification).
But I am not sure that AlarmManager
is reliable solution. Another option is WorkManager, but it has limitation that it can't execute periodic background tasks frequently than 15 minutes interval (this is not case for my app). Also, I found the DeviceAdminService
but it is available only from Android Oreo. I don't know how to solve this problem in lower levels of Api.
- Did you find a way to restore your app after the crash?
I have a requirement that the app must recover itself after any kinds of the crash. I think that AlarmManager
solves this problem partially, but maybe you found more elegant solution.
from android-testdpc.
Related Issues (20)
- add android.permission.POST_NOTIFICATIONS HOT 1
- No toolchains found HOT 1
- DeviceAdminReceiver.onProfileProvisioningComplete() not getting called on when managed profile is created HOT 1
- ADB provisioning command in README is not very noticable HOT 1
- Bazel build is failing HOT 1
- WifiEapTlsCreateDialogFragment's save feature not capable of saving any WiFi Configurations
- Android tester HOT 1
- Cross profile calendar not working properly HOT 1
- cannot import this project to my android studio even after loading bazel plugins HOT 1
- Getting error in "bazel build testdpc" command HOT 3
- Review testing setup HOT 2
- TesDPC keeps stopping after Reboot in Android 14 HOT 1
- Can not revoke admin to uninstall testdpc HOT 2
- Screen text not visible properly HOT 1
- Issue while running bazel //:testdpc HOT 1
- Unable to setup managed profile HOT 4
- After successfully import, bazel sync has some error HOT 1
- add zh_cn language
- Exception while testing generateKeyPair
- How to allow access to work data from personal apps? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-testdpc.