• <i id='EUCCp'><tr id='EUCCp'><dt id='EUCCp'><q id='EUCCp'><span id='EUCCp'><b id='EUCCp'><form id='EUCCp'><ins id='EUCCp'></ins><ul id='EUCCp'></ul><sub id='EUCCp'></sub></form><legend id='EUCCp'></legend><bdo id='EUCCp'><pre id='EUCCp'><center id='EUCCp'></center></pre></bdo></b><th id='EUCCp'></th></span></q></dt></tr></i><div id='EUCCp'><tfoot id='EUCCp'></tfoot><dl id='EUCCp'><fieldset id='EUCCp'></fieldset></dl></div>

    <tfoot id='EUCCp'></tfoot>

      • <bdo id='EUCCp'></bdo><ul id='EUCCp'></ul>

      <small id='EUCCp'></small><noframes id='EUCCp'>

    1. <legend id='EUCCp'><style id='EUCCp'><dir id='EUCCp'><q id='EUCCp'></q></dir></style></legend>

      1. 位置管理器不会删除位置更新!

        时间:2023-09-01
        1. <legend id='QQaDv'><style id='QQaDv'><dir id='QQaDv'><q id='QQaDv'></q></dir></style></legend>

            <tbody id='QQaDv'></tbody>

              • <bdo id='QQaDv'></bdo><ul id='QQaDv'></ul>
                <i id='QQaDv'><tr id='QQaDv'><dt id='QQaDv'><q id='QQaDv'><span id='QQaDv'><b id='QQaDv'><form id='QQaDv'><ins id='QQaDv'></ins><ul id='QQaDv'></ul><sub id='QQaDv'></sub></form><legend id='QQaDv'></legend><bdo id='QQaDv'><pre id='QQaDv'><center id='QQaDv'></center></pre></bdo></b><th id='QQaDv'></th></span></q></dt></tr></i><div id='QQaDv'><tfoot id='QQaDv'></tfoot><dl id='QQaDv'><fieldset id='QQaDv'></fieldset></dl></div>
                • <tfoot id='QQaDv'></tfoot>
                • <small id='QQaDv'></small><noframes id='QQaDv'>

                  本文介绍了位置管理器不会删除位置更新!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  可能重复:
                  Android:如何取消位置更新请求有意图吗?

                  我正在尝试禁用我之前在其他活动中创建的待处理意图(广播),但我无法让它工作.我读过我应该重新创建意图(具有相同的附加功能和所有内容),将其作为参数传递,以便我可以实例化pendingIntent,然后将pendingIntent 作为参数传递给位置管理器的removeUpdates 方法.

                  I am trying to disable a pending intent(broadcast) which I have previously created in a different activity but I can't get it to work. I've read that I should recreate the intent(with the same extras and everything), pass it as a parameter so that I can instantiate the pendingIntent and then pass the pendingIntent as a parameter to the location managers removeUpdates method.

                  换句话说:

                  Bundle extra = new Bundle();
                  
                  extra.putString("name", extras.getString("poiName")); //create same extras
                  
                  extra.putInt("id", extras.getInt("rowId")); //create same extras
                  
                  Intent intent = new Intent(PROX_ALERT_INTENT);  
                  
                  intent.putExtra(PROX_ALERT_INTENT, extra);  //put same extras in the intent
                  
                  PendingIntent proximityIntent = PendingIntent.getBroadcast(this.getApplicationContext(),extras.getInt("rowId") , intent, PendingIntent.FLAG_UPDATE_CURRENT);  //pass in the intent
                  
                  LocationManager locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
                                                                 locationManager.removeUpdates(proximityIntent);  //remove pendingIntent
                  

                  <小时>

                  这不起作用,所以我认为这可能与我作为新对象传入的意图有关,而与用于创建待处理意图的意图不同.


                  That didn't work so I thought that it might have to do with the intent that im passing in being a new object and not the same with the one used in order to create the pending intent.

                  所以我尝试在创建它后立即删除pendingIntent,但也没有用:

                  So I tried removing the pendingIntent right after I create it but that didnt work either:

                  Bundle extras = new Bundle();
                  
                      extras.putString("name", poiName);
                  
                      extras.putInt("id", requestCode);
                  
                      Intent intent = new Intent(PROX_ALERT_INTENT);
                  
                      intent.putExtra(PROX_ALERT_INTENT, extras);
                  
                      PendingIntent proximityIntent = PendingIntent.getBroadcast(this.getApplicationContext(), requestCode , intent, PendingIntent.FLAG_CANCEL_CURRENT);
                  
                      locationManager.addProximityAlert(
                          latitude, // the latitude of the central point of the alert region
                          longitude, // the longitude of the central point of the alert region
                          POINT_RADIUS, // the radius of the central point of the alert region, in meters
                          PROX_ALERT_EXPIRATION, // time for this proximity alert, in milliseconds, or -1 to indicate no expiration 
                          proximityIntent // will be used to generate an Intent to fire when entry to or exit from the alert region is detected
                     );
                      locationManager.removeUpdates(proximityIntent);
                  

                  <小时>

                  你能帮我吗???从周三开始就一直在窃听...希望我有更多的声誉可以在这个上设置一个边界...


                  Can you please help me with that??? Its been bugging be since wednesday...wish i had more reputation to put a boundy on this one...

                  谢谢

                  麦克

                  推荐答案

                  通过重新创建 Intent 然后在待处理的 Intent 上调用 .cancel() 来解决它...

                  Resolved it by recreating the intent and then calling .cancel() on the pending intent...

                  这篇关于位置管理器不会删除位置更新!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:美国所有州的 iOS 覆盖(MKPolygon)数据? 下一篇:iOS 5 中来自后台地理围栏的通知?

                  相关文章

                  最新文章

                  • <bdo id='8cqcx'></bdo><ul id='8cqcx'></ul>

                    <small id='8cqcx'></small><noframes id='8cqcx'>

                    <i id='8cqcx'><tr id='8cqcx'><dt id='8cqcx'><q id='8cqcx'><span id='8cqcx'><b id='8cqcx'><form id='8cqcx'><ins id='8cqcx'></ins><ul id='8cqcx'></ul><sub id='8cqcx'></sub></form><legend id='8cqcx'></legend><bdo id='8cqcx'><pre id='8cqcx'><center id='8cqcx'></center></pre></bdo></b><th id='8cqcx'></th></span></q></dt></tr></i><div id='8cqcx'><tfoot id='8cqcx'></tfoot><dl id='8cqcx'><fieldset id='8cqcx'></fieldset></dl></div>

                    <legend id='8cqcx'><style id='8cqcx'><dir id='8cqcx'><q id='8cqcx'></q></dir></style></legend>
                    <tfoot id='8cqcx'></tfoot>