-
Notifications
You must be signed in to change notification settings - Fork 14
MapmyIndia Safety Plugin
MapmyIndia Safety Plugin will alert a user who is in or near to a containment zone. If the app is running, a callback method will be called to get the containment zone information. Safety plugin will push a local notification when the user goes near to the containment zone or in a containment zone, which can be seen from the notification panel.
A few extra step you have to follow in order to integrate MapmyIndia Safety Plugin in your application.
dependencies {
classpath 'com.google.gms:google-services:4.3.3'
}
MapmyIndiaSafetyPlugin
.getInstance()
.initialize(new IAuthListener() {
@Override
public void onSuccess() {
// After successful authentication onSuccess() will be called.
}
@Override
public void onError(String reason, String errorIdentifier, String errorDescription) {
// reason gives the error type.
// errorIdentifier gives information about error code.
// errorDescription gives a message for a particular error.
}
});
MapmyIndiaSafetyPlugin.getInstance().initialize(object : IAuthListener {
override fun onSuccess() {
// After successful authentication onSuccess() will be called.
}
override fun onError(reason: String, errorIdentifier: String, errorDescription: String) {
// reason gives the error type.
// errorIdentifier gives information about error code.
// errorDescription gives a message for a particular error
}
})
MapmyIndiaSafetyPlugin
.getInstance()
.startSafetyPlugin(new ISafetyListener() {
@Override
public void onResult(ContainmentZoneInfo zoneInfo) {
// onResult will return a ContainmentZoneInfo object.
//zoneInfo.isInsideContainmentZone() --True if user stays inside the containment zone else false.
//zoneInfo.getDistanceToNearestZone() --Distance in meters to the nearest containment zone.
//zoneInfo.getMapLink() --Map link for containment zone.
//zoneInfo.getDistrictName() --Name of the district.
//zoneInfo.getZoneType() -- District Zone current type like red, orange and green zone.
}
@Override
public void onError(String reason, String errorIdentifier, String errorDescription) {
// reason gives the error type.
// errorIdentifier gives information about error code.
// error description gives a message for a particular error.
}
});
MapmyIndiaSafetyPlugin.getInstance().startSafetyPlugin(object : ISafetyListener {
override fun onResult(zoneInfo: ContainmentZoneInfo) {
//zoneInfo.isInsideContainmentZone --True if user stays inside the containment zone else false.
//zoneInfo.distanceToNearestZone --Distance in meters to the nearest containment zone.
// zoneInfo.mapLink --Map link for containment zone.
//zoneInfo.districtName --Name of the district.
//zoneInfo.zoneType -- District Zone current type like red, orange and green zone.
}
override fun onError(reason: String, errorIdentifier: String, errorDescription: String) {
Timber.e("OnError:" + reason + "errorIdentifier:- " + errorIdentifier)
}
})
MapmyIndiaSafetyPlugin.getInstance().stopSafetyPlugin();
MapmyIndiaSafetyPlugin.getInstance().stopSafetyPlugin()
// Get the corona safety information for the current location by calling following method.
MapmyIndiaSafetyPlugin
.getInstance()
.getCurrentLocationSafety(new ISafetyListener() {
@Override
public void onResult(ContainmentZoneInfo zoneInfo) {
// onResult will return a ContainmentZoneInfo object.
//zoneInfo.isInsideContainmentZone() --True if user stays inside the containment zone else false.
//zoneInfo.getDistanceToNearestZone() --Distance in meters to the nearest containment zone.
//zoneInfo.getMapLink() --Map link for containment zone.
//zoneInfo.getDistrictName() --Name of the district.
//zoneInfo.getZoneType() -- District Zone current type like red, orange and green zone.
}
@Override
public void onError(String reason, String errorIdentifier, String errorDescription) {
// reason gives the error type.
// errorIdentifier gives information about error code.
// error description gives a message for a particular error.
}
});
MapmyIndiaSafetyPlugin.getInstance().getCurrentLocationSafety(object : ISafetyListener {
override fun onResult(zoneInfo: ContainmentZoneInfo) {
// onResult will return a ContainmentZoneInfo object.
//zoneInfo.isInsideContainmentZone --True if user stays inside the containment zone else false.
//zoneInfo.distanceToNearestZone --Distance in meters to the nearest containment zone.
//zoneInfo.mapLink --Map link for containment zone.
//zoneInfo.districtName --Name of the district.
//zoneInfo.zoneType -- District Zone current type like red, orange and green zone.
}
override fun onError(reason: String, errorIdentifier: String, errorDescription: String) {
// reason gives the error type.
// errorIdentifier gives information about error code.
// error description gives a message for a particular error.
}
})
-
isInsideContainmentZone (boolean)
- True if user stays inside the containment zone else false. -
containmentZoneName (String)
- Name of the containment zone. -
mapLink (String)
- Map link for containment zone. -
distanceToNearestZone (Long
) - Distance to the nearest containment zone. -
districtName (String)
- Name of the district. -
zoneType (String)
- District Zone current type like red, orange and green zone.
- 204: No matches were found for the provided query.
- 400: Bad request.
- 401: unauthorized request. Access to API is forbidden.
- 500: Something went wrong.
- 503: Maintenance Break
For any queries and support, please contact:
Email us at [email protected]
Stack Overflow Ask a question under the mapmyindia-api
Support Need support? contact us!
Blog Read about the latest updates & customer stories
© Copyright 2020. CE Info Systems Pvt. Ltd. All Rights Reserved. | Terms & Conditions.
- Map UI Settings
- Set Country Regions
- Set MapmyIndia MapStyle
- REST API Kit
- MapmyIndia GeoAnalytics
- Place Autocomple Widget
- MapmyIndia Safety Plugin
- MapmyIndia Interactive Layer
- MapmyIndia GeoFence View
- MapmyIndia Safety Strip
- MapmyIndia Place Picker
- MapmyIndia Scalebar Plugin
- ELocation Strategy
- MapmyIndia Direction Widget
- MapmyIndia Nearby Search Widget
- Version History
- Country List