我想在Android设备上使用我最基本的Gluon Mobile应用程序调用本机服务。例如,通过在GoNative示例应用程序中完成的操作,我可以获得这样的TelephonyManager
实例:
TelephonyManager telephonyManager= (TelephonyManager)FXActivity.getInstance().getSystemService(android.content.Context.TELEPHONY_SERVICE);
但这个例子似乎不是最新的。我看到它在die build.gradle
文件中使用了几个lib的早期版本,而在我的配置中,使用了3.0.0
版本。
似乎有API更改,因为FXActivity
甚至不再提供getSystemService()
功能。
因此,在当前版本中,如何获取TelephonyManager并访问其余的原生Android服务?