GithubHelp home page GithubHelp logo

hypertrack / live-app-android Goto Github PK

View Code? Open in Web Editor NEW
715.0 71.0 217.0 30.54 MB

Build live location sharing in your Android app

Home Page: https://play.google.com/store/apps/details?id=com.hypertrack.live

License: MIT License

Java 75.63% Kotlin 24.37%
location location-services locations location-based-services fusedlocation fusedlocationapi livelocation eta

live-app-android's Introduction

Live Location Sharing

Open Source Love License: MIT

This open source app for Live Location Sharing is built with HyperTrack. Developers can now build live location sharing into their apps within minutes by using HyperTrack Live source code. For iOS, refer to our open source iOS repository.

HyperTrack Live for Android is available on the Google Play Store for use by users signed up with HyperTrack. HyperTrack Live for iOS is available on the public App Store.

πŸ‘‹ Read our blog post announcement to learn more about this sample app.

The app demonstrates a simple flow for users to share their live location with friends through their favorite messaging app when on the way to meet up. The convenient 23-character secure short-URL displays live location with accuracy, speed, bearing and recency. The view highlights the ongoing activity (walk, drive, stop, etc.). Device getting inactive due to permissions or other reasons, or disconnected due to unknown reasons is highlighted in the tracking experience. Battery charing and low battery states are flagged as well.

Live Location Sharing

The primary feature of Hypertrack Live is Live Location Sharing. Live Location Sharing is useful for:

  • Workforce productivity apps with messaging and customer support capabilities
  • Peer-to-peer marketplaces for goods and services
  • Ridesharing and carpooling apps
  • Consumer apps like messengers and social apps

It helps solve the user's anxiety of β€œwhere are you⁉️”.

Architecture

Architecture

Step by step process of communication:
  1. User makes a request to go to destination at location X
    • Prior to creating a trip to go to destination X, the user signs in into HyperTrack Live App using a HyperTrack account. HyperTrack Live App authenticates the user to Live App Backend and obtains a JWT auth token to access it. Live App Backend serves as a backend platform example for HyperTrack Live App to demonstrate the following:
      • Performs as HyperTrack Live App user management service. For this example, we use HyperTrack dashboard account user management as the way to perform HyperTrack Live App user management. You may wish to use your own user management setup for the app you are building.
      • Performs as HypeTrack Live App backend server performing HyperTrack APIs calls which require authentication via AccountId and SecretKey available in the setup page.
    • Once the user picks a location in the app and creates a trip with a destination to it, HyperTrack Live App performs a call to Live App Backend with the JWT token from the above.
  2. Create trip to destination at location X via Trips API
    • Live App Backend uses HyperTrack Trips API to create a trip with destination X. In order to authenticate to use the API, Live App Backend uses AccountId and SecretKey.
  3. Show trip route with ETA with live updates to the user
    • HyperTrack Views SDK queries the new trip information and provides trip information to HyperTrack Live App user. In addition, HyperTrack Views SDK receives realtime updates from HyperTrack platform and provides them as callbacks to HyperTrack Live App.
  4. User shares public short URL for the trip to locaton X with live ETA
    • HyperTrack Live App user can share a publicly visible trip URL for the trip with anyone on the internet with a browser.
  5. Short URL recipient tracks user with live ETA to destination at location X
    • The recipient or multiple recipients of the publicly visible trip URL can view HyperTrack Live App user ETA and location in realtime.
  6. User ends live location sharing
    • HyperTrack Live App user may end the trip upon reaching the destination. HyperTrack Live App notifies Live App Backend while authenticating with the JWT token from above.
  7. Complete trip to destination at location X via Trips API
    • Live App Backend uses HyperTrack Trips API to complete the trip with destination X.
    • HyperTrack Trips API updates HyperTrack Views SDK in HyperTrack Live App with a completed trip summary to be displayed to the user. Additionally, recipients of publicly visible trip URL receive a live update about the trip completion and are displayed a completed trip summary as well.

How HyperTrack Live App uses HyperTrack Trips API

HyperTrack Live App uses HyperTrack Trips API to create and complete trips by using Live App Backend. Live App Backend allows to integrate with HyperTrack Trips API via backend server integration.

Once the trip is created in the HyperTrack Live App, the Live App calls Live App Backend which in turn creates a trip via Trips API. Once the trip is completed, the app notifies Live App Backend, which in turn calls HyperTrack Trips API to complete the trip.

Usage

To use this app

Clone this repository
$ git clone https://github.com/hypertrack/live-app-android.git

$ cd live-app-android
Register app in Firebase
  1. Goto Firebase Console and create test project (or you can reuse existing one)

  1. Register new Android application using com.hypertrack.live package name.

  1. Download google-services.json file and copy it to app/ folder.

Run app on device

Go through one-time registration flow in the app.

Finish setup

Verify your email and proceed to setup page. where you should fill FCM Key section in Android paragraph obtained from Firebase Developer console > Project Settings (gear icon at top left) > Cloud Messaging tab.

Documentation

For detailed documentation of the APIs, customizations and what all you can build using HyperTrack, please visit the official docs.

Contribute

Feel free to clone, use, and contribute back via pull requests. We'd love to see your pull requests - send them in! Please use the issues tracker to raise bug reports and feature requests.

We are excited to see what Live Location feature you build in your app using this project. Do ping us at [email protected] once you build one, and we would love to feature your app on our blog!

Support

Join our Slack community for instant responses. You can also email us at [email protected].

live-app-android's People

Contributors

agraebe avatar alexhypertrack avatar amanjain08 avatar arjunattam avatar bonish avatar codacy-badger avatar deniszpua avatar guristas avatar jerdog avatar pavel-kuznetsov-hypertrack avatar piyushgupta27 avatar ravijain412 avatar tulushev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

live-app-android's Issues

Getting Unexpected response code 502

Hi HyperTrack Team

I am getting unexpected response code : 502

Requested Url : https://api.hypertrack.com/api/v1/users/
Body : UserParams{deviceName='SM-G925I', name='gaurav', phone='null', lookupId='dsgdvgdgsffdtsftfst', photo='null', groupId='null', groupLookupId='null'}

Response : 502: There was an error on the server and we have been notified. Try again later.

<title>502 Bad Gateway</title>

502 Bad Gateway

Please suggest, in which scenario this error will occur

Thansks
Gaurav

App crash

when you come to foreground by clicking on the notification and your location service is disable you are asked to enable the gps. if you click on the cancel button the app crashes every time.

device: moto g3
OS : 6.0.1

Hypertrack SDK is not running

Hello,

I tried to follow this https://github.com/hypertrack/live-app-android#usage documentation on this app

With the same computer and smartphone versions also the similar steps to reproduce with this link hypertrack/quickstart-android#24, I produced the same error (Hypertrack SDK is not running).

Expected Behavior

The HyperTrack SDK is running when the app is running as seen in this picture https://hypertrack.com/docs/img/live-ios.jpg.

Actual Behavior

The HyperTrack SDK is running when the app is running.
The proof: the text and background color of the label TextView are "Inactive" (not "Active") and red (not green) as seen in the picture below

Picture

image

Debug

The background color of the label TextView is red because onTrackingStop function inside MainActivity.java is called

public void onTrackingStop() {
      trackingStatus.setActivated(false);
      trackingStatus.setText(R.string.inactive);
      trackingStatusText.setText(String.format(getString(R.string.tracking_is), getString(R.string.disabled).toLowerCase()));
  }

The onTrackingStop function is called because the SDK is not running either inside trackingStateReceiver instance

private BroadcastReceiver trackingStateReceiver = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {

        int code = intent.getIntExtra(TrackingStateObserver.EXTRA_KEY_CODE_, 0);
        switch (code) {
            case TrackingStateObserver.EXTRA_EVENT_CODE_START:
                onTrackingStart();
                break;
            case TrackingStateObserver.EXTRA_EVENT_CODE_STOP:
                onTrackingStop();
                break;
            default:
                onError(code);
        }
    }
};

or inside onStateUpdate function

if (hyperTrack != null) {
    if (hyperTrack.isRunning()) {
        onTrackingStart();
    } else {
        onTrackingStop();
    }
}

Hypothesis

I assume that the problem is with my smartphone (because has the same issue as hypertrack/quickstart-android#24) but I don't know what πŸ˜‚πŸ˜‚πŸ˜‚

Hypertrack Notification and Stop Running Location Sharing

Hi Hypertrack Team

I am using hypertrack sdk in my app for location sharing. I want to know how we can customize notification icon which is show in app notification bar.

I want to also know, suppose if i am sharing my location to other people and when i stop sharing from other user end so how i can know status of running sharing. on the basis of i have to disable/remove notification icon.

Please suggest me solution for this

Thanks
Gaurav

Invalid token error

PI gives this error createUser: 403: You do not have permission to access the resource. {"detail":"Invalid token."}. I have already applied my test production key in key.properties

Cannot create directory!!

Error:Execution failed for task ':app:packageDebug'.

Cannot create directory C:\Users\admin\Downloads\C1MP\hypertrack-live-android-master\app\build\outputs\apk\debug\C:\Users\admin\Downloads\C1MP\hypertrack-live-android-master\app\build\intermediates\instant-run-resources
capture

Live app notification though its not tracking

I have cleared live app in recent apps and also I made sure in playground that device is not tracking. But still if I turn on gps I get to see notification saying searching for location. Hopw you'll fix this.
Attached necessary screenhots
Screenshot_2020-09-01-15-25-46-198_com miui home
Screenshot_2020-09-01-15-25-57-962_com hypertrack live

Unable to run this app in my Android Studio

I followed step by step the procedure given in the readme but every time I try building the project, I get this error-:
Error:Execution failed for task ':app:fabricGenerateResourcesDebug'.
Crashlytics Developer Tools error.

Please help me out !!!
Curious to contribute to this project ;-)

Eaxmple app issue

E/Volley: [826] BasicNetwork.performRequest: Unexpected response code 402 for https://api.hypertrack.com/api/v1/actions/
05-16 12:30:23.831 20544-20544/io.hypertrack.sendeta E/NetworkManagerImpl: 402: Payment needs to be enabled for using Actions. {"detail":"You have reached the action limit for your account. To continue using, please visit https://dashboard.hypertrack.com/settings"}
java.lang.RuntimeException: 402: Payment needs to be enabled for using Actions. {"detail":"You have reached the action limit for your account. To continue using, please visit https://dashboard.hypertrack.com/settings"}

at com.hypertrack.lib.internal.common.network.NetworkErrorUtil.getException(NetworkErrorUtil.java:81)
at com.hypertrack.lib.internal.common.network.HTTPClient.processError(HTTPClient.java:356)
at com.hypertrack.lib.internal.common.network.HTTPClient.access$000(HTTPClient.java:31)
at com.hypertrack.lib.internal.common.network.HTTPClient$8.onErrorResponse(HTTPClient.java:134)
at com.android.volley.Request.deliverError(Request.java:564)
at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:101)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6121)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)

Demo app ETA always show same value

When I am switching between the tabs for vehicle type selection the request is being made but the response is always same and is not updated on UI.

Problem with Persistent notification

Hi Team,
I have added Hypertrack sdk in my application. But i am facing an issue with persistent notifications while live location is shared. I am not able to set launch mode for the activity class which should be opened when this notification is tapped.
In ServiceNotificationParamsBuilder we can only set activity class name (setContentIntentActivityClass()) and extra data with intent (setContentIntentExtras()). Is there any method to set launch modes for intent?

Please help.

Thanks,
kajol

SubscriptionUpdatesRcvr: onFailure: for deviceId

I m getting error when am going to get moment status by passing device id as an argument.

final String deviceID = HyperTrack.getDeviceId(); // o/p 892BC97E-E7B3-4869-AW1A-EVE86A709AE3

hypertrackView = HyperTrackViews.getInstance(LocationTrackActivity.this, HyperTrackPublicKey);
hypertrackView.getDeviceMovementStatus(deviceID,
new Consumer() {
@OverRide
public void accept(MovementStatus movementStatus) {

                }
            }
    );

hypertrackView.subscribeToDeviceUpdates(deviceID, new DeviceUpdatesHandler() {
@OverRide
public void onLocationUpdateReceived(@nonnull Location location) {
Log.d(TAG, "onLocationUpdateReceived: " + location);
}
@OverRide
public void onBatteryStateUpdateReceived(@MovementStatus.BatteryState int i) {
Log.d(TAG, "onBatteryStateUpdateReceived: " + i);
}

        @Override
        public void onStatusUpdateReceived(@NonNull StatusUpdate statusUpdate) {
            Log.d(TAG, "onStatusUpdateReceived: " + statusUpdate);
        }

        @Override
        public void onTripUpdateReceived(@NonNull Trip trip) {
            Log.d(TAG, "onTripUpdateReceived: " + trip);
        }

        @Override
        public void onError(Exception e, String deviceId) {
            Log.w(TAG, deviceId+" :onError: "+e.toString());
        }

        @Override
        public void onCompleted(String deviceId) {
            Log.d(TAG, "onCompleted: " + deviceId);
        }
    });

I am getting error like below.

SubscriptionUpdatesRcvr: onFailure: for deviceId 892BC97E-E7B3-4869-AW1A-EVE86A709AE3
com.apollographql.apollo.exception.ApolloException: Failed to parse subscription response: {data=null, errors=[{path=null, locations=[{line=1, column=877, sourceName=null}], message=Validation error of type FieldUndefined: Field 'generate_estimate' in type 'Destination' is undefined @ 'subscribeToLatestEvent/trip/destination/generate_estimate'}]}
at com.apollographql.apollo.internal.interceptor.AppSyncSubscriptionInterceptor$1$1.run(AppSyncSubscriptionInterceptor.java:105)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object java.util.Map.get(java.lang.Object)' on a null object reference
at com.apollographql.apollo.internal.interceptor.AppSyncSubscriptionInterceptor$1$1.run(AppSyncSubscriptionInterceptor.java:79)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)Β 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)Β 
at java.lang.Thread.run(Thread.java:818)Β 

Can't sign up on demo app

API gives this error createUser: 403: You do not have permission to access the resource. {"detail":"Invalid token."}. I have already applied my test production key in key.properties

map is not Showing

whatsapp image 2018-04-12 at 12 53 38 am
please help me out

AIzaSyCO7_e6qLRHE9FWrg3FEAfy4pmGmbrr8_ec BRANCH_LIVE_KEY BRANCH_TEST_KEY

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.