How to access native Android services from a Gluon Mobile app?

懵懂的女人 提交于 2019-12-11 14:25:10

问题


I'd like to call native services from my very basic Gluon Mobile application on an Android device. For example, by how it's done in the GoNative sample application, I can obtain a TelephonyManager instance like this:

 TelephonyManager telephonyManager= (TelephonyManager)FXActivity.getInstance().getSystemService(android.content.Context.TELEPHONY_SERVICE);

But the example seems not to be up to date. I see that it uses earlier versions of several libs in die build.gradle file while in my config, the 3.0.0versions are used.

It seems that there were API changes as FXActivity doesn't even offer the getSystemService() function anymore.

So, in the current version, how can I obtain a TelephonyManager and access the rest of the native Android services?

来源:https://stackoverflow.com/questions/37972698/how-to-access-native-android-services-from-a-gluon-mobile-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!