i吉i 发布的帖子
var pw = new PackageManager(context);
报错
error instantiating (Failed to define class): class android.content.pm.PackageManager is interface or abstract
events.observeNotification();
events.on("notification", function(n) {
n.delete();
});
不知道是Bug还是调用方法不对,有没有人告诉我正确的打开方式。
启动其它应用时不时的不生效。附上临时解决模块
importClass(java.io.File);
function launchp(pn) {
if (new File("/data/data/" + pn).exists()) {
context.startActivity(context.getPackageManager().getLaunchIntentForPackage(pn));
sleep(1000);
if (currentPackage() == pn) {
return true;
} else {
return false;
}
} else {
return false;
}
}
module.exports = launchp;
另外在4.2.14中,调用以下代码会崩溃,
requestScreenCapture();
log(findImage(captureScreen(),images.read("./00.webp")));
附上崩溃记录
Version: 476
Android: 29
android.os.RemoteException: Remote stack trace:
at com.android.server.media.projection.MediaProjectionManagerService$MediaProjection.start(MediaProjectionManagerService.java:476)
at android.media.projection.IMediaProjection$Stub.onTransact(IMediaProjection.java:135)
at android.os.Binder.execTransactInternal(Binder.java:1021)
at android.os.Binder.execTransact(Binder.java:994)
java.lang.RuntimeException:Failure delivering result ResultInfo{who=null, request=17777, result=-1, data=Intent { (has extras) }} to activity {org.autojs.autojs/org.autojs.autojs.ui.main.MainActivity_}: java.lang.SecurityException: Media projections require a foreground service of type ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION
android.app.ActivityThread.deliverResults(ActivityThread.java:4938)
......
Caused by:
android.os.RemoteException:Remote stack trace:
at com.android.server.media.projection.MediaProjectionManagerService$MediaProjection.start(MediaProjectionManagerService.java:476)
at android.media.projection.IMediaProjection$Stub.onTransact(IMediaProjection.java:135)
at android.os.Binder.execTransactInternal(Binder.java:1021)
at android.os.Binder.execTransact(Binder.java:994)