access gps location from java on windows

时间:2019-04-16 22:31:30

标签: java windows geolocation windows-rt

I'm trying to retrieve the most accurate geolocation of a user, which is using a java app and i haven't found anyway to access the location property, i've seen apps on the store doing it but i want to do it from a java app

what i have tried is creating a UWP class lib with visual studio and putting static methods inside, and then i thought of using jni4net to invoke it from java but i wasn't able to compile the dll

isn't there anyway to interact with the windows runtime from java, and how would i access the gps location by any other way

1 个答案:

答案 0 :(得分:0)

经过大量研究,我发现了一些可以满足我的需求,但不是完美的解决方案。

我创建了一个C#控制台应用程序,并使用System.Device.Location API检索地理位置并将其打印到控制台,然后将其编译为exe文件,并将该exe文件与我的库一起打包。

java应用程序运行exe并获取其输出并按需要使用它,唯一的问题是C#控制台应用程序无法启用lcoation,因此,如果位置不正确,则用户必须手动启用它,我希望这种方法可以帮助某人。