fleet/tools/android
Victor Lyuboslavsky cc5b4f3947
Install Fleet android agent on device enrollment. (#36050)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #35434

Feature is largely behind feature flag `FLEET_DEV_ANDROID_AGENT_PACKAGE`
Set it like: `export
FLEET_DEV_ANDROID_AGENT_PACKAGE=com.fleetdm.agent.private.victor`

Rough set up:
1. Change the applicationId of your Android app in `build.gradle.kts`:
```kt
    defaultConfig {
        applicationId = "com.fleetdm.agent.private.you"
```
2. Build a release version of your app (use dummy signing key). Build ->
Generate Signed App Bundle or APK ...
3. Get the super secret Google Play URL like: `go run
tools/android/android.go --command enterprises.webTokens.create
--enterprise_id 'XXXX'`
4. Upload your signed app.
5. Wait ~10 minutes
6. Enroll your Android device.
7. The agent should start installing pretty soon. Check your Google Play
in Work profile. Mine was pending for a while the last time I tried it
and I restarted the device before it actually started installing.

@ksykulev you can use this Android service method for "notification":
`AddFleetAgentToAndroidPolicy(ctx context.Context, enterpriseName
string, hostConfigs map[string]AgentManagedConfiguration) error`
You'll need to update `AgentManagedConfiguration` struct to define what
to send down to the device. It includes the enroll secret, so I think we
need to send it down every time just to be safe.

# Checklist for submitter

- Changes file will be updated when full feature is done.

## Testing

- [x] QA'd all new/changed functionality manually
2025-11-21 14:42:24 -06:00
..
android.go Install Fleet android agent on device enrollment. (#36050) 2025-11-21 14:42:24 -06:00