gpt4 book ai didi

java - 如何将(添加)邻近警报的 Intent 传递到广播接收器中?

转载 作者:行者123 更新时间:2023-12-01 15:39:38 25 4
gpt4 key购买 nike

如何将(添加)proximityalert 的 Intent 传递到广播接收器中?以及如何使 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);

最佳答案

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

使用 getBroadcast() 而不是 getActivity() 并提供一个 Intent 来标识 list 注册的 BroadcastReceiver .

关于java - 如何将(添加)邻近警报的 Intent 传递到广播接收器中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8278644/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com