X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=src%2Fro%2Fieval%2Ffonbot%2FUtils.java;h=f06c43acc6813e0003796a472080e37d2bc7251b;hb=6b9507db27500572e4366b3f23eefeea079a9d8f;hp=1262513a3a477a2358c54eb603e57647b6cec9d3;hpb=b26f32d6098549c204dba44f353e10fe30a29781;p=fonbot.git diff --git a/src/ro/ieval/fonbot/Utils.java b/src/ro/ieval/fonbot/Utils.java index 1262513..f06c43a 100644 --- a/src/ro/ieval/fonbot/Utils.java +++ b/src/ro/ieval/fonbot/Utils.java @@ -411,7 +411,7 @@ public final class Utils { } /** - * Poll the server for pending commands. + * Poll the server for pending commands. This function must not be called from BroadcastReceivers * * @param context Context instance */ @@ -419,6 +419,16 @@ public final class Utils { new HttpCallExecutableRunnable("/get", null, context, new PollResultCallback(context), false).execute(); } + /** + * Poll the server for pending commands from {@link FonBotMainService}. This function should be used from BroadcastReceviers instead of {@link #pollServer} + * + * @param context Context instance + */ + public static void safePollServer(final Context context){ + final Intent intent=new Intent(context, FonBotMainService.class); + intent.setAction(FonBotMainService.ACTION_TRIGGER_POLL); + context.startService(intent); + } /** * Executes a given command *