我在新的expo和react-native
当我运行从IOS模拟器(内博览会)的应用程序总是开机的IphoneX.如果我需要更改模拟器,我必须通过Xcode打开它,有什么方法可以更改默认模拟器吗?
我正在使用react-navigation,我有一个嵌套的StackNavigatorinsdie我的TabNavigator
这里是代码
const MainNavigator = TabNavigator({
selectadmin: { screen: SelectAdminScreen },
otp: { screen: OtpScreen },
password: { screen: PasswordScreen },
pin: { screen: PinScreen },
main: {
screen: TabNavigator({
orders: {
screen: StackNavigator({
orderlist: { screen: OrderListScreen },
orderdetail: { screen: OrderDetailScreen }
})
}
},
{
tabBarPosition: 'bottom',
lazy: true,
tabBarOptions: {
labelStyle: { fontSize: 12 }
}
})
}
},
{
navigationOptions: {
tabBarVisible: false
},
tabBarPosition: 'bottom',
swipeEnabled: false,
lazy: true,
animationEnabled: false, …Run Code Online (Sandbox Code Playgroud) 我需要在后台检查互联网连接....我在我的数据库中保存一些数据,每当我上网时,它应该在我的服务器上传数据...我需要一个后台服务,它将检查互联网连接即使我关闭我的应用程序,我尝试了几个方法,但他们都只有我打开我的应用程序... ...目前我正在检查这样的互联网连接
/checking internet connection
ConnectivityManager connectivityManager = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
if(connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED ||
connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED) {
//we are connected to a network
connected = true;
}
else
//not connected to internet
connected = false;
if(connected) {
//getting teacher data if INTERNET_STATE is true(if will be still true if connected to a wifi or network without internet)
getOfflineSubjectData();
getTeacherData();
}
else{
getOfflineSubjectData();
Toast.makeText(teacher_homePage.this,"no internet",Toast.LENGTH_SHORT).show();
}
Run Code Online (Sandbox Code Playgroud)
注意 我不想要一个在关闭我的应用程序后无效的方法...就像我们关闭应用程序时的whatsapp一样,我们仍然会收到短信