How to cause addProximityAlert() to create notification in status bar?
<p>I have an app that notifies the user they are near something based on physical location (GPS)</p>

<p>Originally I did the location proximity checks manually, comparing the current lat/long to the specific target we are looking for.  If it is less than a given range, a notification is created.</p>

<p>After doing this all manually, I found the addProximityAlert() method which is exactly what I need.  I have a method to create the notification manually.  </p>

<p>Unfortunately, I don't know how to bridge the gap between calling a notification manually and creating one as an intent fired by addProximityAlert()</p>

<pre><code>public void SetupLocationListener()
{
    LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    if (useProximityAlerts)
    {
        SetupProximityAlerts(lm);
    }
    else
    {
        LocationListener ll = new mylocationlistener(this, tv);
        lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 5000, 10, ll);
    }
}
</code></pre>

<p>Here is my function which manually creates a notification</p>

<pre><code>    public void AlertUser(String title, String text)
{
    String ns = Context.NOTIFICATION_SERVICE;
    NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);

    int icon = R.drawable.icon;
    CharSequence tickerText = "Location found.";
    long when = System.currentTimeMillis();

    notification = new Notification(icon, tickerText, when);

    Context context = getApplicationContext();
    CharSequence contentTitle = title;
    CharSequence contentText = text;
    Intent notificationIntent = new Intent(this, gps.class);
    PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);

    notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
    final int HELLO_ID = 1;

    mNotificationManager.notify(HELLO_ID, notification);
}
</code></pre>

<p>And here is my incomplete call to addProximityAlert()</p>

<pre><code>lm.addProximityAlert(Double.parseDouble(allLocations[i][1]), Double.parseDouble(allLocations[i][2]), Integer.parseInt(allLocations[i][3].toString()), -1, INTENT_GOES_HERE);
</code></pre>

<p>So how do I "convert" that AlertUser() notification to a PendingIntent I can pass as a variable to addProximityAlert()?</p>

<p>Thanks
Kevin</p>
