| | |
| | | |
| | | import android.Manifest; |
| | | import android.annotation.TargetApi; |
| | | import android.content.ComponentName; |
| | | import android.content.Intent; |
| | | import android.content.pm.PackageInfo; |
| | | import android.content.pm.PackageManager; |
| | |
| | | import android.widget.AdapterView; |
| | | import android.widget.ListView; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.fwupgrade.saymanss.adapter.FwFileListAdapter; |
| | | import com.fwupgrade.saymanss.deviceplug.IUsbDevicePlugDelegate; |
| | |
| | | UStorageTestModule.getInstance().initUStorageDeviceModuleWithVirtualDisk(AppPathInfo.getLogPath()); |
| | | } |
| | | |
| | | |
| | | public void openThirdPartyApp(String pkgName) { |
| | | try { |
| | | // 替换为第三方应用程序的包名和MainActivity的完整类名 |
| | | String mainActivityName = pkgName+".MainActivity"; |
| | | |
| | | // 创建Intent来启动第三方应用程序的MainActivity |
| | | Intent intent = new Intent(); |
| | | intent.setComponent(new ComponentName(pkgName, mainActivityName)); |
| | | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| | | |
| | | // 启动Intent |
| | | startActivity(intent); |
| | | } catch (Exception e) { |
| | | // 处理异常情况,例如应用程序未安装等 |
| | | e.printStackTrace(); |
| | | Toast.makeText(this, "无法启动第三方应用程序", Toast.LENGTH_SHORT).show(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void onResume() { |
| | | super.onResume(); |
| | | // |
| | | // openThirdPartyApp("safeluck.drive.training"); |
| | | } |
| | | |
| | | @Override |
| | | protected void onNewIntent(Intent intent) { |
| | | Log.d(TAG, "onNewIntent"); |
| | |
| | | |
| | | @Override |
| | | protected void onDestroy() { |
| | | Log.i(TAG,"onDestroy"); |
| | | super.onDestroy(); |
| | | } |
| | | |