TiShadow icon indicating copy to clipboard operation
TiShadow copied to clipboard

[Android] Background Services do not work

Open danturu opened this issue 11 years ago • 8 comments
trafficstars

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

danturu avatar Mar 29 '14 16:03 danturu

Are you using the container app? If so, have you added the necessary bit to the tiapp.xml?

dbankier avatar Mar 30 '14 21:03 dbankier

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...

danturu avatar Mar 31 '14 07:03 danturu

Ok. I see the issue. I'll have a fix/explanation soon.

dbankier avatar Mar 31 '14 07:03 dbankier

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.

dbankier avatar Mar 31 '14 07:03 dbankier

ok, thanx... I will try to isolate services inside TiShadow container.

danturu avatar Mar 31 '14 07:03 danturu

@dbankier There is progress ? It is very necessary to use the service with tishadow. How to do it , any suggestions .

rotorgames avatar Feb 26 '15 06:02 rotorgames

@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.

rotorgames avatar Mar 09 '15 14:03 rotorgames

Awesome.

I'd be very interested to see if AppC accept the PR.

Thanks!

Everyone reading this should watch the PR.

dbankier avatar Mar 09 '15 21:03 dbankier