通过反射判断当前设备是Android还是Harmony
privatestaticfinalStringHARMONYOS"harmony";checkthesystemisharmonyosreturntrueifitisharmonyospublicstaticbooleanisHarmonyOS(){try{ClassclzClass.forName("com.huawei.system.BuildEx");Methodmethodclz.getMethod("getOsBrand");returnHARMONYOS.equals(method.invoke(clz));}catch(ClassNotFoundExceptione){Log.e(TAG,"occuredClassNotFoundException");}catch(NoSuchMethodExceptione){Log.e(TAG,"occuredNoSuchMethodException");}catch(Exceptione){Log.e(TAG,"occurotherproblem");}returnfalse;}