[jitsi-dev] [jitsi-android] NullPointerException when checking setting


#1

Hi,

first of all, if this is the wrong place to ask, please just tell me :slight_smile:

As far as I know, the development of the Android port of Jitsi has been
stopped in February. But some people (including me) still use it, since
there is a lack of good XMPP-clients for Android.
However, someone posted a patch on github which added autostart, such
that Jitsi would start when Android boots
(https://github.com/netmackan/jitsi-android/commit/31ed575f056742c791c50a83b21adee9524e9797).
Because i found it useful, I decided to improve it by adding an option
the settings-menu to enable/disable that feature
(https://github.com/thrimbor/jitsi-android/commit/038b874da4b70a97192a8d262b18842e2ac438d9),
but I ran into a problem which I'm unable to solve on my own: When I try
to check whether the option is enabled, I get a NullpointerException.
Here is the relevant part of the log:

11-05 17:42:02.676 I/ActivityManager(935): Start proc org.jitsi for
broadcast org.jitsi/.android.BootReceiver: pid=2855 uid=10070
gids={50070, 3003, 1015, 1028}
11-05 17:42:02.986 E/AndroidRuntime(2855): java.lang.RuntimeException:
Unable to start receiver org.jitsi.android.BootReceiver:
java.lang.NullPointerException
11-05 17:42:02.986 E/AndroidRuntime(2855): at
org.jitsi.android.JitsiApplication.getConfig(JitsiApplication.java:312)
11-05 17:42:02.986 E/AndroidRuntime(2855): at
org.jitsi.android.BootReceiver.onReceive(BootReceiver.java:35)
11-05 17:42:04.706 I/ActivityManager(935): Process org.jitsi (pid 2855)
has died.

I'm using this code to check the setting:
JitsiApplication.getConfig().getBoolean(START_ON_BOOT_PROPERTY, false)

The part of the code that throws the exception is this:
return ServiceUtils.getService(
聽聽聽聽AndroidGUIActivator.bundleContext,
聽聽聽聽ConfigurationService.class);

I'm guessing that this happens because Jitsi isn't properly initialized
yet, but I don't know enough about the code to see the problem or even
make an educated guess.

So, how do I solve this? Is there another way to get the state of the
setting? Can somebody point out the direction in which I should look?

Regards,
Stefan


#2

Hi Stefan,

I'm the author of the initial patch and I was also experimenting with having autostart configurable but came to about the same conclusion.

If I understand it correctly, if we use the Jitsi configuration mechanism Jitsi and OSGI needs to start first. This is not so good as it uses battery also for those who don't want autostart.

An other option could be to instead go directly on Android configuration and read the property from there.

// Markus

路路路

On 5 November 2014 18:03:15 CET, Stefan Schmidt <thrimbor.github@gmail.com> wrote:

Hi,

first of all, if this is the wrong place to ask, please just tell me :slight_smile:

As far as I know, the development of the Android port of Jitsi has been
stopped in February. But some people (including me) still use it, since
there is a lack of good XMPP-clients for Android.
However, someone posted a patch on github which added autostart, such
that Jitsi would start when Android boots
(https://github.com/netmackan/jitsi-android/commit/31ed575f056742c791c50a83b21adee9524e9797).
Because i found it useful, I decided to improve it by adding an option
the settings-menu to enable/disable that feature
(https://github.com/thrimbor/jitsi-android/commit/038b874da4b70a97192a8d262b18842e2ac438d9),
but I ran into a problem which I'm unable to solve on my own: When I
try
to check whether the option is enabled, I get a NullpointerException.
Here is the relevant part of the log:

11-05 17:42:02.676 I/ActivityManager(935): Start proc org.jitsi for
broadcast org.jitsi/.android.BootReceiver: pid=2855 uid=10070
gids={50070, 3003, 1015, 1028}
11-05 17:42:02.986 E/AndroidRuntime(2855): java.lang.RuntimeException:
Unable to start receiver org.jitsi.android.BootReceiver:
java.lang.NullPointerException
11-05 17:42:02.986 E/AndroidRuntime(2855): at
org.jitsi.android.JitsiApplication.getConfig(JitsiApplication.java:312)
11-05 17:42:02.986 E/AndroidRuntime(2855): at
org.jitsi.android.BootReceiver.onReceive(BootReceiver.java:35)
11-05 17:42:04.706 I/ActivityManager(935): Process org.jitsi (pid 2855)
has died.

I'm using this code to check the setting:
JitsiApplication.getConfig().getBoolean(START_ON_BOOT_PROPERTY, false)

The part of the code that throws the exception is this:
return ServiceUtils.getService(
聽聽聽AndroidGUIActivator.bundleContext,
聽聽聽ConfigurationService.class);

I'm guessing that this happens because Jitsi isn't properly initialized
yet, but I don't know enough about the code to see the problem or even
make an educated guess.

So, how do I solve this? Is there another way to get the state of the
setting? Can somebody point out the direction in which I should look?

Regards,
Stefan

_______________________________________________
dev mailing list
dev@jitsi.org
Unsubscribe instructions and other list options:
http://lists.jitsi.org/mailman/listinfo/dev

--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.


#3

Hi Stefan,

I'm the author of the initial patch and I was also experimenting with having autostart configurable but came to about the same conclusion.

If I understand it correctly, if we use the Jitsi configuration mechanism Jitsi and OSGI needs to start first. This is not so good as it uses battery also for those who don't want autostart.

An other option could be to instead go directly on Android configuration and read the property from there.

// Markus

Hi,

I now ended up doing what you suggested - I'm directly accessing the
SQLite-Database to fetch the property. It's not very nice code, but it
gets the job done and doesn't waste a lot of time or power
(https://github.com/thrimbor/jitsi-android/commit/ea6e7e75878de0d0992694447a9b152664896c5f).

Now there's only a minor annoyance left, when Jitsi autostarts it starts
up in the foreground. Maybe I'll look into that...

Regards,
Stefan

路路路

Am 07.11.2014 um 10:12 schrieb Markus Kil氓s:

On 5 November 2014 18:03:15 CET, Stefan Schmidt <thrimbor.github@gmail.com> wrote:

Hi,

first of all, if this is the wrong place to ask, please just tell me :slight_smile:

As far as I know, the development of the Android port of Jitsi has been
stopped in February. But some people (including me) still use it, since
there is a lack of good XMPP-clients for Android.
However, someone posted a patch on github which added autostart, such
that Jitsi would start when Android boots
(https://github.com/netmackan/jitsi-android/commit/31ed575f056742c791c50a83b21adee9524e9797).
Because i found it useful, I decided to improve it by adding an option
the settings-menu to enable/disable that feature
(https://github.com/thrimbor/jitsi-android/commit/038b874da4b70a97192a8d262b18842e2ac438d9),
but I ran into a problem which I'm unable to solve on my own: When I
try
to check whether the option is enabled, I get a NullpointerException.
Here is the relevant part of the log:

11-05 17:42:02.676 I/ActivityManager(935): Start proc org.jitsi for
broadcast org.jitsi/.android.BootReceiver: pid=2855 uid=10070
gids={50070, 3003, 1015, 1028}
11-05 17:42:02.986 E/AndroidRuntime(2855): java.lang.RuntimeException:
Unable to start receiver org.jitsi.android.BootReceiver:
java.lang.NullPointerException
11-05 17:42:02.986 E/AndroidRuntime(2855): at
org.jitsi.android.JitsiApplication.getConfig(JitsiApplication.java:312)
11-05 17:42:02.986 E/AndroidRuntime(2855): at
org.jitsi.android.BootReceiver.onReceive(BootReceiver.java:35)
11-05 17:42:04.706 I/ActivityManager(935): Process org.jitsi (pid 2855)
has died.

I'm using this code to check the setting:
JitsiApplication.getConfig().getBoolean(START_ON_BOOT_PROPERTY, false)

The part of the code that throws the exception is this:
return ServiceUtils.getService(
聽聽聽AndroidGUIActivator.bundleContext,
聽聽聽ConfigurationService.class);

I'm guessing that this happens because Jitsi isn't properly initialized
yet, but I don't know enough about the code to see the problem or even
make an educated guess.

So, how do I solve this? Is there another way to get the state of the
setting? Can somebody point out the direction in which I should look?

Regards,
Stefan

_______________________________________________
dev mailing list
dev@jitsi.org
Unsubscribe instructions and other list options:
http://lists.jitsi.org/mailman/listinfo/dev


#4

Hi Stefan,

I'm the author of the initial patch and I was also experimenting with having autostart configurable but came to about the same conclusion.

If I understand it correctly, if we use the Jitsi configuration mechanism Jitsi and OSGI needs to start first. This is not so good as it uses battery also for those who don't want autostart.

An other option could be to instead go directly on Android configuration and read the property from there.

// Markus

Hi,

I now ended up doing what you suggested - I'm directly accessing the
SQLite-Database to fetch the property. It's not very nice code, but it
gets the job done and doesn't waste a lot of time or power
(https://github.com/thrimbor/jitsi-android/commit/ea6e7e75878de0d0992694447a9b152664896c5f).

I think this approach should be okay. Sure it is generally not good to
have duplicated code for accessing the configuration but in this case I
think it is motivated.

Now there's only a minor annoyance left, when Jitsi autostarts it starts
up in the foreground. Maybe I'll look into that...

Yes, that would be great to have fixed.

Cheers,
Markus

路路路

On 2014-11-07 19:14, Stefan Schmidt wrote:

Am 07.11.2014 um 10:12 schrieb Markus Kil锟絪:

Regards,
Stefan

On 5 November 2014 18:03:15 CET, Stefan Schmidt <thrimbor.github@gmail.com> wrote:

Hi,

first of all, if this is the wrong place to ask, please just tell me :slight_smile:

As far as I know, the development of the Android port of Jitsi has been
stopped in February. But some people (including me) still use it, since
there is a lack of good XMPP-clients for Android.
However, someone posted a patch on github which added autostart, such
that Jitsi would start when Android boots
(https://github.com/netmackan/jitsi-android/commit/31ed575f056742c791c50a83b21adee9524e9797).
Because i found it useful, I decided to improve it by adding an option
the settings-menu to enable/disable that feature
(https://github.com/thrimbor/jitsi-android/commit/038b874da4b70a97192a8d262b18842e2ac438d9),
but I ran into a problem which I'm unable to solve on my own: When I
try
to check whether the option is enabled, I get a NullpointerException.
Here is the relevant part of the log:

11-05 17:42:02.676 I/ActivityManager(935): Start proc org.jitsi for
broadcast org.jitsi/.android.BootReceiver: pid=2855 uid=10070
gids={50070, 3003, 1015, 1028}
11-05 17:42:02.986 E/AndroidRuntime(2855): java.lang.RuntimeException:
Unable to start receiver org.jitsi.android.BootReceiver:
java.lang.NullPointerException
11-05 17:42:02.986 E/AndroidRuntime(2855): at
org.jitsi.android.JitsiApplication.getConfig(JitsiApplication.java:312)
11-05 17:42:02.986 E/AndroidRuntime(2855): at
org.jitsi.android.BootReceiver.onReceive(BootReceiver.java:35)
11-05 17:42:04.706 I/ActivityManager(935): Process org.jitsi (pid 2855)
has died.

I'm using this code to check the setting:
JitsiApplication.getConfig().getBoolean(START_ON_BOOT_PROPERTY, false)

The part of the code that throws the exception is this:
return ServiceUtils.getService(
聽聽聽AndroidGUIActivator.bundleContext,
聽聽聽ConfigurationService.class);

I'm guessing that this happens because Jitsi isn't properly initialized
yet, but I don't know enough about the code to see the problem or even
make an educated guess.

So, how do I solve this? Is there another way to get the state of the
setting? Can somebody point out the direction in which I should look?

Regards,
Stefan

_______________________________________________
dev mailing list
dev@jitsi.org
Unsubscribe instructions and other list options:
http://lists.jitsi.org/mailman/listinfo/dev