【问题标题】:I can't get the extras that I put into an intent, that I put in a "addProximityAlert"我无法获得我放入意图中的额外内容,即我放入“addProximityAlert”
【发布时间】:2012-01-11 17:17:03
【问题描述】:

我无法在“addProximityAlert”中添加我在意图中添加的额外内容

locationNotific.putExtra("name", "ofek");

   // sendBroadcast(locationNotific); (I can get the extras)

    PendingIntent lPendingIntent = PendingIntent.getBroadcast(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);

广播接收器:

public void onReceive(Context context, Intent intent) {


    IDForNotificationString = intent.getStringExtra("name");
    //MA.notification(IDForNotificationString);

【问题讨论】:

  • 请不要转发同样的问题。如果您有其他信息,请改为编辑您的原始问题。

标签: java android methods android-intent proximity


【解决方案1】:

尝试在您的getBroadcast() 调用中使用FLAG_UPDATE_CURRENT,将您的额外内容与任何先前的PendingIntent 中的任何内容合并到同一核心Intent

【讨论】:

  • 你能举个例子吗
  • @ofeking109:阅读getBroadcast() 的文档,查看标志的位置,然后输入PendingIntent.FLAG_UPDATE_CURRENT 替换您的0
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-01-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-05-02
  • 1970-01-01
相关资源
最近更新 更多