我对我制作的react native应用程序使用地理位置,但是不允许弹出位置权限。
我已在Android Manifest中添加了权限,并尝试使用该库,但结果相同
df <- as.data.frame(unique(Final$Item))
#New Dataframe with Null values
Final_v1 <- NA
j <- 1
i <- 1
#SS computations
#For 1 to no of rows in df(which is having no of unique items
for(j in 1:nrow(df)) {
#copying the data from Final to Final_v1(with charater type)
Final_v1 <- Final[Final$Item == as.character(df[j,1]),]
#for 1 to the no of rows in Final_v1
for(i in 1:nrow(Final_v1)) {
if(Final_v1[i,4] == '1')
{
Final_v1[i,6]=0
}
else
{
Final_v1[i,6]=Final_v1[i,3]
}
# SSNew <- Final_v1[i,6]
#Leftover distribution
LCS <- lctolc$ToLC[Final_v1$Item[i] == lctolc$Item & Final_v1$LC[i] == lctolc$LC]
inds <- Final_v1$LC %in% LCS
if (any(inds))
{ Final_v1$SS[inds]<- if (Final_v1[i,6] == 0) {Final_v1$SS[inds]==0} else {Final_v1$SS[inds]=Final_v1$SS[inds]} }
}
}
names(Final_v1)[6] <- "SSNew"
}
我希望权限位置可以处于活动状态,并且可以显示当前位置的纬度和经度
答案 0 :(得分:0)
您可以使用expo-permissions
您可以运行expo install expo-permissions
您应该获得以下两个特权:
ACCESS_FINE_LOCATION:“ android.permission.ACCESS_FINE_LOCATION” ACCESS_COARSE_LOCATION:'android.permission.ACCESS_COARSE_LOCATION'
示例
import * as Permissions from 'expo-permissions';
const permission = await Permissions.getAsync(Permissions.LOCATION);
if (permission.status !== "granted") {
const newPermission = await Permissions.askAsync(Permissions.LOCATION);
if (newPermission.status === "granted") {
console.log("Permissions granted");
}else {
console.log("newPermission not granted");
}
}else{
console.log("Permissions granted");
}