Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

Get excited for the Samsung Galaxy S5! Find everything you need and discuss it in our Galaxy S5 Forum!

test: Reply
 
LinkBack Thread Tools
Old January 28th, 2013, 03:08 PM   #1 (permalink)
New Member
Thread Author (OP)
 
Join Date: Jan 2013
Posts: 4
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default In BroadcastReceiver get latitude or longtitude of the central point of the alert region that Added

I searched android api for LocationManager.

I have not seen getProximityAlert() function.

In BroadcastReceiver get latitude or longtitude of the central point of the alert region that Added on ProximityAlert Is this possible ?

I need latitude and longtitude because i should get data on database server in order to show some informations.

[HIGH] private void addProximityAlert(double latitude,double longitude) {


Intent intent = new Intent(PROX_ALERT_INTENT);
intent.putExtra("latitude", latitude);
sendBroadcast(intent);
PendingIntent proximityIntent = PendingIntent.getBroadcast(this, 0, intent, 0);
locationManager.addProximityAlert(
latitude, // the latitude of the central point of the alert region
longitude, // the longitude of the central point of the alert region
POINT_RADIUS, // the radius of the central point of the alert region, in meters
PROX_ALERT_EXPIRATION, // time for this proximity alert, in milliseconds, or -1 to indicate no expiration
proximityIntent // will be used to generate an Intent to fire when entry to or exit from the alert region is detected
);
// getIns.getInstance().setGoogleMap(this);
IntentFilter filter = new IntentFilter(PROX_ALERT_INTENT);

this.registerReceiver(ProximityIntentReceiver, filter);
// registerReceiver(new ProximityIntentReceiver(this), filter);

//

}[/HIGH]

[HIGH] private final BroadcastReceiver ProximityIntentReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
String key = LocationManager.KEY_PROXIMITY_ENTERING;
Boolean entering = intent.getBooleanExtra(key, false);
Toast.makeText(getApplicationContext(),"You are near traffic events",Toast.LENGTH_SHORT).show();
//

//
if (entering)
{ double k= intent.getDoubleExtra("latitude", -1); //I dont //get registered central point here.

displayEventConfirmation();

}
}
}; [/HIGH]
Thanks

Editted: Using intent.getDoubleExtra("latitude", -1); i got DoubleExtra whenever activity start.Problem is that there are more than one proximity alert and i need to get proximityalert which zone is entered that should getDoubleExtra should be catched not on activityStarted.
found this link which doesnot work on me :S
android - How to receive location info when receiving a proximity alert intent? - Stack Overflow

Beyaz is offline  
Last edited by Beyaz; January 28th, 2013 at 05:59 PM.
Reply With Quote
sponsored links
Old January 29th, 2013, 10:01 AM   #2 (permalink)
New Member
Thread Author (OP)
 
Join Date: Jan 2013
Posts: 4
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default stuck

Guys im really stuck on this. If anyone help me on that i appreciate that
Beyaz is offline  
Reply With Quote
Reply
Tags
broadcastreceiver


Go Back   Android Forums > Android Development > Application Development
Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 05:01 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.