Note that there are some explanatory texts on larger screens.

plurals
  1. POIntentReceiver doesn't work
    primarykey
    data
    text
    <p>I use addProximityAlert:</p> <pre><code>Intent intent = new Intent(getString(R.string.intent_message_location_fetched)); PendingIntent proximityIntent = PendingIntent.getBroadcast(this, 0, intent, 0); locationManager.addProximityAlert(LAT, LONG, RADIUS, 0, proximityIntent); </code></pre> <p>As I understand intent with action R.string.intent_message_location_fetched should be fired after location will be around LAT LONG. (R.string.intent_message_location_fetched = com.myapp.client.MyActivity.LocationFetched)</p> <p>Then I'm trying to create BroadcastReceiver class:</p> <pre><code>public class MyBroadcastReciver extends BroadcastReceiver { MyActivity mainActivity; public MyBroadcastReciver(MyActivity activity) { mainActivity = activity; } @Override public void onReceive(Context context, Intent intent) { mainActivity.ShowToast("Recived : " + intent.getAction()); } } </code></pre> <p>And register receiver in MyActivity class:</p> <pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); myReciver = new MyBroadcastReciver(this); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(getString(R.string.intent_message_location_fetched)); registerReceiver(myReciver, intentFilter); ... </code></pre> <p>But nothing happens when I'm in LAT LONG location. What's wrong? I've tried register Receiver in manifest, but it didn't help.</p> <p>P.S. When I've used getActivity instead of getBroadcast this worked OK and restored my Activity if it was dead.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload