Is the first Post the latest version?
I think it’s working on others devices correct?
Is the first Post the latest version?
I think it’s working on others devices correct?
Correct.
side note: There are quite some issues in that version though. Mainly missing basic features. I created a new 1 with more and better features but apparently i must’ve messed up with the device admin receiver and it doesn’t work to set it as admin. I tried asking ai but they couldn’t figure it out either. So meanwhile i’m stuck unless someone here can help.
this is what i currently got as DeviceAdmin.java
package com.example.deviceownerapp;
import android.app.admin.DeviceAdminReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;
/**
* This is the core component that receives administrator-level callbacks.
* It's mostly here to be declared in the manifest so the system
* recognizes our app as a potential admin.
*/
public class DeviceAdmin extends DeviceAdminReceiver {
private static final String TAG = "DeviceAdmin";
@Override
public void onEnabled(Context context, Intent intent) {
super.onEnabled(context, intent);
Toast.makeText(context, "Device Admin Enabled", Toast.LENGTH_SHORT).show();
Log.d(TAG, "Device Admin Enabled");
}
@Override
public void onDisabled(Context context, Intent intent) {
super.onDisabled(context, intent);
Toast.makeText(context, "Device Admin Disabled", Toast.LENGTH_SHORT).show();
Log.d(TAG, "Device Admin Disabled");
}
}
Is that meant to be ```?
was just trying each till it worked lol. always forget md syntax
What’s the error when setting?
Got the manifest?
bad component followed by the component name. Tested on sonim and tcl for fun both same error.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.deviceownerapp"> <!-- This is your app's unique ID -->
<!-- Permissions -->
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
tools:ignore="QueryAllPackagesPermission" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.DeviceOwnerApp">
<!-- 1. The Main Activity (App Launcher Entry) -->
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- 2. The App Detail Activity (Hide/Permissions) -->
<activity
android:name=".AppDetailActivity"
android:exported="false" /> <!-- Not exported, only our app can launch it -->
<!-- 3. The Invisible Install Activity -->
<activity
android:name=".InstallActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:exported="true"
android:taskAffinity=""
android:excludeFromRecents="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<!-- This is the MIME type for APK files -->
<data android:mimeType="application/vnd.android.package-archive" />
<!-- Add ZIP and generic binary file types for XAPK -->
<data android:mimeType="application/zip" />
<data android:mimeType="application/octet-stream" />
<!-- Handle "content://" and "file://" schemes -->
<data android:scheme="content" />
<data android:scheme="file" />
</intent-filter>
</activity>
<!-- 4. The Device Admin Receiver (The Core) -->
<receiver
android:name=".DeviceAdmin"
android:description="@string/admin_description"
android:exported="true"
android:permission="android.permission.BIND_DEVICE_ADMIN">
<meta-data
android:name="android.app.admin"
android:resource="@xml/device_admin_policies" />
<intent-filter>
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
</intent-filter>
</receiver>
<!-- 5. The Receiver for Install Results -->
<receiver
android:name=".InstallResultReceiver"
android:exported="false" />
</application>
</manifest>
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is still required, even if empty,
to declare the app as an admin.
-->
<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
<uses-policies>
<!-- As Device Owner, we get powers implicitly. -->
</uses-policies>
</device-admin>
Can you give me exact output?
Did you build debug by mistake?
no purposely so i can easily uninstall if needed. The first version is also debug and can therefore be easily uninstalled but still works to set as admin. Unless i didn’t make the first 1 debug really?
Error: Bad admin: ComponentInfo{com.example.deviceownerapp/com.example.deviceownerapp.DeviceAdmin}
You used two different app names
deviceownerapp
appinstaller
Which one?
The APK posted in op is com.example.appinstaller
the 1 i posted works. Trying to fix new 1
Line 57
android:name="android.app.admin"
Change to:
android:name="android.app.device_admin"
That’s what your old one has, and seems to be the proper way.
thanks! That worked!
Can’t post the new 1 yet. Its better then the old 1 but still has tons of bugs i gotta take care of. Including xapk install function failing. don’t have patience now maybe later. If anyone wants to help please lmk i’ll post the source.
1 weird issue i ran into is that this new app can also hide apps or paths disable any app including system apps. I tried disabling a user app and a system app and it worked perfectly. But then when i rebooted no installed apps show up in applications. I have no clue why. All apps are still installed and still work (i had to launch using am start in termux which came up in recent apps). If anyone knows why or if there’s a fix to this lmk
Which apps did you disable
Pull system and post?
Disabled browser and file explorer.
you mean entire system image? Can do but upload time to google drive is crazy slow here so will take time. If you have another way i can send it to you pm.
Edit: google drive upload will take longer then the time the phone is on between reboots. Since i reset this old phone it reboots every few minutes!
I dunno, there’s probably something there that does a weird check for apps. I’ve seen weirder, like:
https://forums.jtechforums.org/t/small-questions-that-dont-deserve-their-own-thread/393/1058?u=ars18
I’ll be glad to help send source via….
Major update coming to the app. Way easier to play around support for xapk, uninstall from within the app itself, easily update without needing adb each time etc.
total new app. Here’s the readme
A utility application designed for Sonim XP5800 and XP3800 devices (Android 8.1) to facilitate local app installation without constant ADB connection.
These devices often restrict app installation, allowing only ADB or Device Owner/Admin based installations. This app acts as a Device Owner/Admin to bypass these restrictions and allow users to install APK and XAPK files directly from the device.
.apk files..xapk (and .zip) bundles containing Split APKs. Uses robust ZipFile processing to handle various compression types.Android/data/com.example.deviceownerapp/files/app_errors.log.Installation:
adb install -t -r DeviceAdminApp.apkadb shell dpm set-device-owner com.example.deviceownerapp/.DeviceAdmin
Troubleshooting:
adb shell dumpsys account to list them and remove them from Settings > Accounts.Installing Apps:
Uninstallation:
To build this project, you can use the included build.sh script if you are in a Termux environment with the appropriate android.jar.
./build.sh
Ensure you have aapt2, ecj, d8, zip, and apksigner installed.