Friday, October 4, 2013

Re: [android-developers] Re: How to make a Service That will periodically send the Users Location on a server

sorry to say, you looks like collecting the code from here and there and making your application.....  :(

cant do the spoon feeding....

sorry.....  


On Fri, Oct 4, 2013 at 8:08 PM, HImanshu Mittal <himanshu5692@gmail.com> wrote:
Sir,
Actually, I don't know where this code has to be integrated in my code.
And that's why confused, IF you tell me that ,
I would test it right away and tell the update!!


On Fri, Oct 4, 2013 at 7:52 PM, Mukesh Srivastav <mukichamps@gmail.com> wrote:
I think, you have missed the code which i had sent you... check that


On Fri, Oct 4, 2013 at 7:40 PM, HImanshu Mittal <himanshu5692@gmail.com> wrote:
I have enabled it ... 
If it was not enabled the blue dot would not have appeared
But as the permissions are there it appears on the map !!!


On Fri, Oct 4, 2013 at 7:28 PM, Mukesh Srivastav <mukichamps@gmail.com> wrote:
The problem could be , Himanshu is missing the Location setting to be enabled....  :)

Please check the device setting and test your code.


On Fri, Oct 4, 2013 at 7:06 PM, Kristopher Micinski <krismicinski@gmail.com> wrote:
I guess the problem is, if your location is unavailable, how are you expecting that that will be fixed?  This doesn't make any sense, if it's not available, it's not available,

Kris



On Fri, Oct 4, 2013 at 6:16 AM, HImanshu Mittal <himanshu5692@gmail.com> wrote:
Hello friends,
I have just checked it out that my service is working fine but the problem is I am in an area where location is unavalaible and my friend is in an area where location is availaible.
How should I fix this that my location also can be transmitted to my server!!!

Now I think ii could be solved
Please Help!!


On Fri, Oct 4, 2013 at 9:47 AM, HImanshu Mittal <himanshu5692@gmail.com> wrote:
package com.example.metro;

import com.dude5692.StaticURL.ProjectURL;

import json.jSOn;

import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.IBinder;
import android.widget.Toast;

public class MyService extends Service 
{
ProjectURL proURL = new ProjectURL();
String initialURL;
SharedPreferences pref;

@Override
public void onCreate() 
{
// TODO Auto-generated method stub
super.onCreate();
final LocationManager mlocmag = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
final LocationListener mlocList = new MyLocationList();

Criteria criteria = new Criteria();

// Getting the name of the best provider
final String provider = mlocmag.getBestProvider(criteria, true);

final Location loc = mlocmag.getLastKnownLocation(provider);
UpdateWithNewLocation(loc); // This method is used to get updated location. 
mlocmag.requestLocationUpdates(provider, 1000, 0, mlocList);
}

@Override
public IBinder onBind(Intent arg0) 
{
// TODO Auto-generated method stub
return null;
}

@Override
public void onDestroy() 
{
// TODO Auto-generated method stub
super.onDestroy();
}

@Override
public int onStartCommand(Intent intent, int flags, int startId) 
{
// TODO Auto-generated method stub
return super.onStartCommand(intent, flags, startId);
}
private void UpdateWithNewLocation(final Location loc) 
{
// TODO Auto-generated method stub
if(loc!= null)
{
final double lat =loc.getLatitude(); // Updated lat
final double Long = loc.getLongitude(); // Updated long

pref = getSharedPreferences("myMetroFile",Context.MODE_PRIVATE); 
System.out.println("MO   Service Running");
String UniqueDeviceId = pref.getString("DeviceUniqueID", "0");
initialURL = proURL.projectURL + "storeLatLong.php?RegID="+lat+"&Email="+Long+"&Device="+UniqueDeviceId+"&Start=NO";
new Async().execute();
}
else 
{
}
}

class Async extends AsyncTask<String, Void, String>
{

//ProgressDialog progress;

protected String doInBackground(String... params) 
{
try 
{
new jSOn().execute(initialURL);
catch (Exception e) 
{
e.printStackTrace();
}
return null;
}

protected void onPreExecute() 
{
super.onPreExecute();
}

protected void onPostExecute(String result) 
{
super.onPostExecute(result);
}
}

public class MyLocationList implements LocationListener
{

public void onLocationChanged(Location arg0) 
{
// TODO Auto-generated method stub
UpdateWithNewLocation(arg0);
}

public void onProviderDisabled(String provider) 
{
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(),"GPS Disable ", Toast.LENGTH_LONG).show();
}

public void onProviderEnabled(String provider) 
{
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(),"GPS enabled", Toast.LENGTH_LONG).show();
}

public void onStatusChanged(String provider, int status, Bundle extras) 
{
// TODO Auto-generated method stub
}
}
}


On Fri, Oct 4, 2013 at 4:44 AM, Lew <lewbloch@gmail.com> wrote:
 HImanshu Mittal wrote:
Bro , Don't dramatize things out here. I have asked a question thats it.

How is asking for relevant details dramatizing it?

It's spelled "that's".
 
For the first the first time I have asked a question on any forum regarding a help in my 8 months of development time.

Not important.
 
I was not able to make a code because the code which I have made is not working.

That's like telling a doctor, "I don't feel well" and expecting a diagnosis. You need to provide details.
 
If you can provide the code than it will be really be helpful or I can also post my code out here than you can tell me where I am doing it wrong
 
:)


Since that's what the guy was asking for, why do you give him a hard time? 

On Thu, Oct 3, 2013 at 9:23 PM, Steve Gabrilowitz <steve...@gmail.com> wrote:

You are more likely to get help developing your own service if tell us in which areas you have been less than successful.  If you are looking for a full piece of code already written for you then try Google ;-)

Follow his advice.

-- 
Lew
 

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "Android Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/android-developers/cFXbDUmDh6E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Warm Regards,
Mukesh Kumar,
Android Consultant/Freelancer,
India,Hyderabad.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "Android Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/android-developers/cFXbDUmDh6E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Warm Regards,
Mukesh Kumar,
Android Consultant/Freelancer,
India,Hyderabad.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "Android Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/android-developers/cFXbDUmDh6E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Warm Regards,
Mukesh Kumar,
Android Consultant/Freelancer,
India,Hyderabad.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate