[英]Get context of foreground activity in Service
I have a service and I want to get context of topmost activity which is currently running on foreground. 我有一个服务,我想获取当前正在前台运行的最高活动的上下文。 The service is in my own app and topmost activity is from another app (the activity is not from my app).
该服务位于我自己的应用程序中,最重要的活动来自另一个应用程序(该活动不是来自我的应用程序)。 Is it possible ?
可能吗 ? If yes, how?
如果是,怎么办?
Edit : I need to get context because, I want to apply custom distortion to images rendered by Google VR service. 编辑:我需要获取上下文,因为我想对Google VR服务渲染的图像应用自定义失真。 How I plan to do is:
我打算怎么做:
onDrawFrame()
methods etc. from GvrView and apply custom distortion onDrawFrame()
方法等并应用自定义变形 Service cannot get context of current active activity. 服务无法获取当前活动的上下文。 But you achieve your scenario other way.
但是您可以通过其他方式实现您的方案。
Services
can access share preference
, Database
, broadcast reciever
and etc..). Services
可以访问share preference
, Database
, broadcast reciever
等。) onReceive()
, on that function apply custom distortion to images rendered by google vr service. onReceive()
的本地广播,在该函数上将自定义失真应用于由Google VR服务渲染的图像。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.