Bundled daemon fails on Ice cream sandwich when using webview

3 posts / 0 new
Last post
Bundled daemon fails on Ice cream sandwich when using webview
rav
rav's picture
Offline
Joined
04/25/2012 - 07:16
Posted
Wed, 05/23/2012 - 16:41

I have encountered a strange error and I can easily reconstruct it in the simple service example.

The example still works fine after including the bundled daemon like in this guide: https://www.alljoyn.org/content/guide-alljoyn-development-using-java-sdk...

However adding these lines to main.xml breaks alljoyn.

    <WebView
        android:id="@+id/webview"
        android:layout_gravity="center"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />

There are no error messages, but findAdvertisedName from simpleClient won't find anything. Not on the same device and not on any other device.

This only occurs, if the sampleService is launched on Android 4. It works fine on 2.3.7. After experimenting a bit I found out that created sessions are not interrupted. So if a client connects, before a webview is created, the session keeps working. Afterwards no new clients can connect to the service.

Can anyone confirm this or does anybody have a solution to fix this issue?

Re: Bundled daemon fails on Ice cream sandwich when using ...
Nikhil Dabhade Moderator
Nikhil Dabhade's picture
Offline
Joined
01/27/2011 - 17:39

Hi rav,

Are you doing all the AllJoyn specific things in the main thread of the application ? I noticed you mentioned that you used simple service to reconstruct this error but in case you modified it here is a precaution that you should take: Ideally you should not be doing things in the main thread/UI thread of any the application.

Let me know and we can look further into this.

Regards,
Nikhil 

Re: Bundled daemon fails on Ice cream sandwich when using ...
rav
rav's picture
Offline
Joined
04/25/2012 - 07:16

Thanks for your reply.

In our application we use the same approach as in simpleChat. AllJoyn runs as a service with it's own background handler, we use the application class to coordinate things, so everything should run in different threads.

I have simply chosen simpleservice, because it was the smallest example that could be easily modified to reproduce the error.

I added "org.alljoyn.bus.alljoyn.DaemonInit.PrepareDaemon(getApplicationContext());" to onCreate in service.java
and <service android:name="org.alljoyn.bus.alljoyn.BundleDaemonService"></service> to AndroidManifest.xml. And of course bundle.jar and libdaemon-jni.so in libs (does not matter if debug or release).

This works fine on gingerbread, but not on ICS. However, if I install the standalone daemon AllJoyn.apk, it will get startet instead of the bundled one and everything works even on ICS. It would be nicer though, if the user did not have to install two applications.

Webview also requires android.permission.INTERNET. Maybe it interferes somehow? Even if I close the activity with the webview, alljoyn won't recover.