How to use android location manager for extensions?
-
As being a noop in java I am struggling in understanding the use of Android's LocationManager and how it is working.
In order to understand how this donw I used QtPositioning as basis. The java is not an activity and therefore the standard manifest part is not working. The complaint is that QtPositioning resp the renamed versioncannot be cast to an activity.
Basically you can neglect the AndroidManifest.xml and the routines are called. Unfortunately a pointer is left as a null. The reason is that the initialzation through :
static public void setContext(Context context) { try { locationManager = (LocationManager)context.getSystemService(Context.LOCATION_SERVICE); } catch(Exception e) { e.printStackTrace(); } }
is missing.
Theoretically the routine could be called by QAndroidJniObject::callStaticMethod<void>. However, it is not clear to me which and where to find the required context as parameter.
Can anybody shed some light on this?
Are there other alternatives? -
@koahnig said in How to use android location manager for extensions?:
However, it is not clear to me which and where to find the required context as parameter.
the context is most probably either the activity or the service you are running in
see QtAndroid::androidContext() -
OK, thanks. That seems to work.