如何将意图从(添加)邻近警报发送到广播接收器?
以及如何使onreceive方法起作用?

Intent locationNotific = new Intent("SendProximityIntent");
    locationNotific.putExtra("RowID", id);
    sendBroadcast(locationNotific);
    PendingIntent lPendingIntent = PendingIntent.getActivity(this, 0, locationNotific, 0);

       IntentFilter filter = new IntentFilter("SendProximityIntent");

       registerReceiver(new ProximityIntentReceiver(), filter);


    lm.addProximityAlert((double) locationAlertGeoP.getLatitudeE6(),(double) locationAlertGeoP.getLongitudeE6(), (float) 999999999,(long) 100000,lPendingIntent);

最佳答案

如何将意图从(添加)邻近警报发送到广播接收器?


使用getBroadcast()代替getActivity(),并提供一个Intent来标识清单清单中的BroadcastReceiver

08-18 06:43