how to call service from receiver
<p>In my application I want to call service from Receiver.</p>

<p>This is my NotificationReceiver.java</p>

<pre><code> public class NotificationReceiver extends BroadcastReceiver {

    NotificationReceiver _this = this;
    private static Context _context;
    public static final String ACTION_REFRESH_SCHEDULE_ALARM = "com.example.receiver.ACTION_REFRESH_SCHEDULE_ALARM";
    String SERVER_URL = "http://192.168.1.7:8080";

    @Override
    public void onReceive(final Context context, Intent intent) {
        _context = context;
        initClient();
        SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(_context);


        if (settings.getString("userId",null) != null){

            gotNotification(new ClientListener(){
                @Override
                public void onSuccess(String response) {
                    try {
                        JSONObject object = new JSONObject(response);

                        System.out.println("Service object = "+ object);


                    } catch (JSONException e) {
                        e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
                    }
                }
                @Override
                public void onFail(int error) {

                }
                @Override
                public void onCancel() {

                }

            },settings.getString("userId",null));
        }
    }

    private void initClient(){
        NotifierRestClient.init(SERVER_URL + "/api");
    }

    private void gotNotification (final ClientListener clientListener, final String uId) {
        new Thread() {
            @Override
            public void run() {
                try {
                    final String responseText = NotifierRestClient.getUserNotifications(uId,null);
                    if (clientListener != null) {
                        clientListener.onSuccess(responseText);
                    }
                } catch (final Exception e) {
                    e.printStackTrace();
                    if (clientListener != null) {
                        clientListener.onFail(505);
                    }
                }
            }
        }.start();
    }
}
</code></pre>

<p>And this is my NotifiactionService.java</p>

<pre><code>public class NotificationService extends Service {

    private AlarmManager alarmManagerPositioning;
    private PendingIntent pendingIntent;

    @Override
    public void onCreate() {
        super.onCreate();

        alarmManagerPositioning = (AlarmManager) getSystemService(Context.ALARM_SERVICE);

        final Intent intentToNotificate = new Intent(NotificationReceiver.ACTION_REFRESH_SCHEDULE_ALARM);
        pendingIntent = PendingIntent.getBroadcast(this, 0, intentToNotificate, 0);
    }

    @Override
    public void onStart(Intent intent, int startId) {
        try {

            long notificationInterval = 5002;

            alarmManagerPositioning.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime(), notificationInterval, pendingIntent);
        } catch (NumberFormatException e) {
            Toast.makeText(this, "error running services: " + e.getMessage(), Toast.LENGTH_SHORT).show();
        } catch (Exception e) {
            Toast.makeText(this, "error running services: " + e.getMessage(), Toast.LENGTH_SHORT).show();
        }
    }

    @Override
    public IBinder onBind(Intent arg0) {
        return null;
    }

    @Override
    public void onDestroy() {

        this.alarmManagerPositioning.cancel(pendingIntent);


    }
}
</code></pre>

<p>My question is how to call NotificationService in NotificationReceiver and change  interval? Any help will be useful Thanks </p>
