有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何将意图从(添加)proximityalert获取到broadcastreceiver?

如何将意向从(添加)proximityalert获取到broadcastreceiver? 以及如何使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);

共 (1) 个答案

  1. # 1 楼答案

    how to get the intent from the (add)proximityalert into a broadcastreceiver?

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