Android Open Source - GeoDeals-android Service Starter






From Project

Back to project page GeoDeals-android.

License

The source code is released under:

GNU General Public License

If you think the Android project GeoDeals-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.geomoby.geodeals.receiver;
// ww  w  .j a  va2  s.  c  o m
import com.geomoby.logic.GeomobyStartService;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.util.Log;

public class ServiceStarter extends BroadcastReceiver {

  final String PREF_NAME="checked";

    @Override
    public void onReceive(Context context, Intent intent) {
      
      SharedPreferences spref = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);

      // User privacy - Restart the service only if the service was activated before the device reboot
    if ( spref.getBoolean("check",false) == true){
      Log.d("ServiceStarter", "Restart the GeoMoby service...");
      // Start the GeoMoby tracking service
        context.startService(new Intent(context, GeomobyStartService.class));
    }
      
      //SharedPreferences.Editor editor = spref.edit();
    //editor.putBoolean("check", true);
    //editor.commit();
    
    }
}




Java Source Code List

com.geomoby.geodeals.DemoService.java
com.geomoby.geodeals.MainActivity.java
com.geomoby.geodeals.notification.CustomNotification.java
com.geomoby.geodeals.receiver.ServiceStarter.java
com.geomoby.geodeals.splash.SplashActivity.java