|
|
@ -4,7 +4,6 @@ import androidx.appcompat.app.AppCompatActivity; |
|
|
|
|
|
|
|
|
|
|
|
import android.os.Bundle; |
|
|
|
import android.os.Bundle; |
|
|
|
import android.util.Log; |
|
|
|
import android.util.Log; |
|
|
|
import android.view.View; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.io.File; |
|
|
|
|
|
|
|
|
|
|
@ -13,23 +12,19 @@ import top.niunaijun.blackbox.entity.pm.InstallResult; |
|
|
|
|
|
|
|
|
|
|
|
public class MainActivity extends AppCompatActivity { |
|
|
|
public class MainActivity extends AppCompatActivity { |
|
|
|
public static final String TAG = "MainActivity"; |
|
|
|
public static final String TAG = "MainActivity"; |
|
|
|
public static final int USER_ID = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void onCreate(Bundle savedInstanceState) { |
|
|
|
protected void onCreate(Bundle savedInstanceState) { |
|
|
|
super.onCreate(savedInstanceState); |
|
|
|
super.onCreate(savedInstanceState); |
|
|
|
setContentView(R.layout.activity_main); |
|
|
|
setContentView(R.layout.activity_main); |
|
|
|
findViewById(R.id.btn_click).setOnClickListener(new View.OnClickListener() { |
|
|
|
findViewById(R.id.btn_click).setOnClickListener(v -> { |
|
|
|
@Override |
|
|
|
String hlx = "com.huluxia.gametools"; |
|
|
|
public void onClick(View v) { |
|
|
|
boolean installed = BlackBoxCore.get().isInstalled(hlx); |
|
|
|
String hlx = "com.huluxia.gametools"; |
|
|
|
if (!installed) { |
|
|
|
boolean installed = BlackBoxCore.get().isInstalled(hlx); |
|
|
|
InstallResult installResult = BlackBoxCore.get().installPackage(new File("/sdcard/huluxia.apk")); |
|
|
|
if (!installed) { |
|
|
|
Log.d(TAG, "onClick: " + installResult.toString()); |
|
|
|
InstallResult installResult = BlackBoxCore.get().installPackage(new File("/sdcard/huluxia.apk")); |
|
|
|
|
|
|
|
Log.d(TAG, "onClick: " + installResult.toString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
BlackBoxCore.get().launchApk(hlx); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
BlackBoxCore.get().launchApk(hlx); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |