Open hytTony opened 1 year ago
Context
created this way is not full. You can not use it for sending intents.pm
). There is no way to bypass this security restriction.
Context
created this way is not full. You can not use it for sending intents.- Android will not start service if apk is not installed via package manager (
pm
). There is no way to bypass this security restriction.
OK, thanks. I try to use ContentProvider in stead of this
@rom1v I think this issue can be closed.
`private static Context getContext(){ try { Class<?> activityThreadClass = Class.forName("android.app.ActivityThread"); Constructor<?> activityThreadConstructor = activityThreadClass.getDeclaredConstructor(); activityThreadConstructor.setAccessible(true); Object activityThread = activityThreadConstructor.newInstance();
`private static void bindAIDLService(){ try{ Context context = getContext(); /Intent intent = new Intent(); intent.setPackage("com.xhuwei.firstview"); intent.setAction("org.xhuwei.shixun.RemoteService"); context.bindService(intent, connection, context.BIND_AUTO_CREATE);/
bindService and startService got errors: java.lang.SecurityException: Unable to find app for caller android.app.IApplicationThread$Stub$Proxy@f838900 (pid=9750) when binding service Intent { act=org.xhuwei.shixun.RemoteService pkg=com.xhuwei.firstview }
java.lang.SecurityException: Unable to find app for caller android.app.IApplicationThread$Stub$Proxy@680d95b (pid=2246) when starting service Intent { cmp=android/com.xhuwei.firstview.RemoteService }
How to do this ? Thanks!