TiShadow
TiShadow copied to clipboard
[Android] Background Services do not work
how can I use background services? I've got the following warn (it works when compile using pure titanium cli):
Unable to start service Intent { cmp=com.yydigital.tishadowapp/.Appdata-private:__test_android_mediaService }: not found
Are you using the container app? If so, have you added the necessary bit to the tiapp.xml?
you mean tishadowapp's tiapp.xml?
I've just added it to tishadowapp's tiapp.xml, recompiled but it doesn't work. Same error. I don't use a stand-alone application that runs on TiShadow (http://www.yydigital.com/blog/2013/2/19/TiShadow_Appify)
from tishadowapp's tiapp.xml:
...
<services>
<service url="media.js" type="interval" />
</services>
</android>
from my application's tiapp.xml:
...
<services>
<service url="media.js" type="interval" />
</services>
</android>
like i said before it works without tishadow container. hmm...
Ok. I see the issue. I'll have a fix/explanation soon.
So the issue is that when using TiShadow the source is placed in the applicationDataDirectory (the writable area) but I didn't think background services can work like that at the moment. For example if you change to the tiapp.xml in the tishadowapp to something like this:
<services>
<service url="appdata-private://my_app/logservice.js" type="interval"/>
</services>
It can't compile. Not sure how to fix this at the moment... The workaround for the moment is to build the service into the container app or just do not use service. You can use the Ti.Shadow property to see if you are running inside TiShadow.
ok, thanx... I will try to isolate services inside TiShadow container.
@dbankier There is progress ? It is very necessary to use the service with tishadow. How to do it , any suggestions .
@dbankier @rosendi I sent a pull request with corrections https://github.com/appcelerator/titanium_mobile/pull/6698
The service works with tishadow, hope appcelerator, take my changes.
Awesome.
I'd be very interested to see if AppC accept the PR.
Thanks!
Everyone reading this should watch the PR.