https://github.com/map-ir/mapir-android-tracker
Map Android Live Tracking SDK
https://github.com/map-ir/mapir-android-tracker
Last synced: about 1 year ago
JSON representation
Map Android Live Tracking SDK
- Host: GitHub
- URL: https://github.com/map-ir/mapir-android-tracker
- Owner: map-ir
- Created: 2019-11-02T12:46:44.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-11-16T09:35:40.000Z (over 6 years ago)
- Last Synced: 2025-03-28T17:06:55.534Z (over 1 year ago)
- Language: Java
- Size: 267 KB
- Stars: 8
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README-FA.md
Awesome Lists containing this project
README
# نصب
## Features
- Map.ir Live Tracker uses MQTT protocol which has low data usage.
- Easy configuration.
- Complete and expressive documentation.
- You can use both Java and Kotlin languages.
## Example
The example applications are the best way to see `MapirLiveTracker` in action. Simply clone and open app in Android Studio.
## Installation
Add this line in dependencies scope in your project's app.gradle :
```bash
implementation 'ir.map.tracker:tracker:$latest_version'
```
## Usage
### Publisher
1.Create publisher object and use static method getLiveTracker to initialize object to work with it :
```
Publisher publisher = Publisher.getLiveTracker(context, API_KEY, track_id, true, new TrackerEvent.PublishListener() {
@Override
public void publishedLocation(Location location) {
// Each published location
}
@Override
public void onFailure(PublisherError error) {
switch (code) {
case LOCATION_PERMISSION:
// Missing Location permission
break;
case TELEPHONY_PERMISSION:
// Missing Telephony permission
break;
case INITIALIZE_ERROR:
// Something went wrong during sdk initilization
break;
case API_KEY_NOT_AVAILABLE:
// Provided access token is missing or wrong
break;
}
}
@Override
public void onLiveTrackerDisconnected() {
// Tracker disconnected
}
});
publisher.start(INTERVAL); // INTERVAL is in miliseconds and should be at least 1000
```
### Subscriber
1.Create subscriber object and use static method getLiveTracker to initialize object to work with it :
```
Subscriber subscriber = Subscriber.getLiveTracker(context, API_KEY, track_id, new TrackerEvent.SubscribeListener() {
@Override
public void onLocationReceived(Location location) {
// Recieved location
}
@Override
public void onFailure(SubscriberError error) {
switch (code) {
case TELEPHONY_PERMISSION:
// Missing Telephony permission
break;
case INITIALIZE_ERROR:
// Something went wrong during sdk initilization
break;
case API_KEY_NOT_AVAILABLE:
// Provided access token is missing or wrong
break;
}
}
@Override
public void onLiveTrackerDisconnected() {
Toast.makeText(MainActivity.this, "onLiveTrackerDisconnected", Toast.LENGTH_SHORT).show();
}
});
subscriber.start(); // Start receiving locations
```
## Contributing
Contributions are very welcome 🙌
## License
License is available in LICENSE file.