Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how i can remove this error

C#
Implicit super constructor Provider.Service() is undefined. Must explicitly invoke another constructor





Java
public class GPSTracker extends Service implements LocationListener{

	 final Context context;
	boolean isGPSEnable=false;
	boolean isNetworkEnable=false;
	
	boolean canGetLocation=false;
	Location location;
	double latiude;
	double longitude;
	private static final long min_time_between_updates=1000*60*1;
	private static final long min_diatance_cahnge_for_updates=10;
	
	protected LocationManager locationManager;
	
	
	
	public GPSTracker(Context context) {
	
	this.context=context;
	getlocation();
	
	}
	

	public Location getlocation(){
		try{
			locationManager=(LocationManager)context.getSystemService(Context.LOCATION_SERVICE);
			isGPSEnable=locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
			isNetworkEnable=locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);			
			
			if (isGPSEnable&&!isNetworkEnable) {
				
			}
			else{
				
				
				this.canGetLocation=true;
				if(isNetworkEnable){
					locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,min_time_between_updates, 
							min_diatance_cahnge_for_updates,  this);
					if(locationManager!=null){
						
						location=locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
						if(location!=null){
							latiude=location.getLatitude();
							longitude=location.getLongitude();							
						}//third inner						
					}//inner second					
				}//main if
				if(isGPSEnable){
					locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,min_time_between_updates, 
							min_diatance_cahnge_for_updates,  this);
					if(locationManager!=null){
						
						location=locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
						if(location!=null){
							latiude=location.getLatitude();
							longitude=location.getLongitude();							
						}//third inner						
					}//inner second					
				}//main if
				
				
				
				
			}
			
			
			
		}catch(Exception e){			
			e.printStackTrace();			
		}
Posted

1 solution

Sometimes, Eclipse gives this error when you have project setup - system configuration mismatch.

For example if you import Java 1.7 project to Eclipse and you do not have 1.7 correctly set up then you will get this error. Then you can either go to Project - Preference - Java - Compiler and switch to 1.6 or earlier; or go to Window - Preferences - Java - Installed JREs and add/fix your JRE 1.7 installation.

You can also try to clean and build the workspace (menu Project -> Clean...)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900