Hi,

I'm getting $subject whenever the device get restarted. Exception details
as follows:

java.lang.RuntimeException: Unable to start receiver
org.wso2.mdm.agent.services.DeviceStartupIntentReceiver:
java.lang.NullPointerException: Attempt to invoke virtual method
'java.lang.String java.lang.String.trim()' on a null object reference
            at
android.app.ActivityThread.handleReceiver(ActivityThread.java:2586)
            at
android.app.ActivityThread.access$1700(ActivityThread.java:144)
            at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1355)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5221)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual
method 'java.lang.String java.lang.String.trim()' on a null object reference
            at
org.wso2.mdm.agent.services.DeviceStartupIntentReceiver.setRecurringAlarm(DeviceStartupIntentReceiver.java:61)
            at
org.wso2.mdm.agent.services.DeviceStartupIntentReceiver.onReceive(DeviceStartupIntentReceiver.java:45)
            at
android.app.ActivityThread.handleReceiver(ActivityThread.java:2579)
            at
android.app.ActivityThread.access$1700(ActivityThread.java:144)
            at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1355)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5221)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

​This is occurred when device invoke *setRecurringAlarm()* method in
*DeviceStartupIntentReceiver
*class at the start-up.​ The reason for getting this exception because it
tries to get the '*mode*' string from *SharedPreference* and trim it.
However the '*mode*' is not stored there.

Code Snippet
-------------------

String mode = Preference.getString(context,
resources.getString(R.string.shared_pref_message_mode));

if (NOTIFIER_MODE.equals(mode.trim().toUpperCase(Locale.ENGLISH))) { ... }

​
According to what I have understood, it checks the *NOTIFICATION_MODE*
whether *LOCAL* or *GCM*.

So my questions are, *where should I set this 'mode' preference and how do
we decide whether it should be LOCAL or GCM?*
​

-- 
Milan Harindu Perera
Software Engineer
*WSO2, Inc*
(+94) 77 309 7088
lean . enterprise . middleware
<http://lk.linkedin.com/in/milanharinduperera>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to