android 进入电影院时如何通知用户?

2024-01-25

在我的 Android 应用程序中,我有地图视图和当前位置,现在显示最近的剧院,我想在用户进入剧院(如地理围栏)时通知用户,我在 NET 上搜索并没有找到任何支持地理围栏的 Android api,请帮助如何做到这一点?

注意:我尝试过http://geofence.locationlabs.com/ http://geofence.locationlabs.com/但不起作用意味着 API 密钥未合并。 任何示例代码都非常有帮助,提前致谢


嘿我找到了解决方案试试这个,

我们必须实施 PendingIntent 和位置管理器。位置管理器获取用户的当前位置,当用户进入某个区域时,它将触发一个待处理的意图,一些代码片段如下:

//---use the LocationManager class to obtain locations data---
lm = (LocationManager)
getSystemService(Context.LOCATION_SERVICE);
//---PendingIntent to launch activity if the user is within some locations---
PendingIntent pendIntent = PendingIntent.getActivity(
this, 0, new
Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("http://www.amazon.com")), 0);
lm.addProximityAlert(37.422006, -122.084095, 5, -1, pendIntent);

addProximityAlert 方法,我们可以在其中设置区域(用户跟踪的半径)here http://developer.android.com/reference/android/location/LocationManager.html#addProximityAlert%28double,%20double,%20float,%20long,%20android.app.PendingIntent%29是 addProximityAlert 方法的更多细节。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

android 进入电影院时如何通知用户? 的相关文章