Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Android 4 Application Development
This is the forum to discuss the Wrox book Professional Android 4 Application Development Reto Meier; ISBN: 978-1-1181-0227-5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Android 4 Application Development section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 14th, 2013, 06:21 AM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default WhereAmI project

Hi ,
I'm trying to create GPS alert notification when we the mobile arrive to specific point in 100m radius.
this is my code that deal with, please let me know what i'm doing wrong:

the setProximityAlert methud :

private void setProximityAlert(){

String locService = Context.LOCATION_SERVICE;
LocationManager locationManager;
locationManager = (LocationManager) getSystemService(locService);

double lat = 31.59819563;
double lng = 34.78952749;
float radius = 100f; //meters
long expiration = -1; // never stop

Intent intent = new Intent(TREASURE_PROXIMITY_ALERT);
PendingIntent proximityIntent = PendingIntent.getBroadcast(this, -1, intent, 0);

locationManager.addProximityAlert(lat, lng, radius, expiration, proximityIntent);


}

the ProximityIntentReceiver class :

package com.example.whereami;

import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.location.LocationManager;

public class ProximityIntentReceiver extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {
String key = LocationManager.KEY_PROXIMITY_ENTERING;

boolean entering = intent.getBooleanExtra(key, false);
if (entering) {
AlertDialog alertDialog = new AlertDialog.Builder(context).create();
alertDialog.setTitle("Pay attention!");
alertDialog.setMessage("You are going to ......");
alertDialog.setCanceledOnTouchOutside(false);
alertDialog.setButton(DialogInterface.BUTTON_POSIT IVE, "YES", new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface arg0, int arg1) {

}
});
alertDialog.setButton(DialogInterface.BUTTON_NEGAT IVE, "NO", new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface arg0, int arg1) {
// TODO Auto-generated method stub

}
});
} else {
AlertDialog alertDialog = new AlertDialog.Builder(context).create();
alertDialog.setTitle("Pay attention!");
alertDialog.setMessage("There is no signal");
alertDialog.setCanceledOnTouchOutside(false);
}

}

}
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 22: Introduction to Project Management... Project Program integration chrisa BOOK: Professional Application Lifecycle Management with Visual Studio 2010 1 September 15th, 2010 03:28 PM
Website project vs Web Application Project... thenoseknows ASP.NET 2.0 Professional 0 January 14th, 2007 09:47 PM
UserControl of One Project in Other Project gadhiav ASP.NET 1.0 and 1.1 Professional 2 February 18th, 2006 07:51 AM
Add report of one project into another project tejaswibv Crystal Reports 0 July 13th, 2005 04:40 AM



All times are GMT -4. The time now is 08:19 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.