Data Sync & Messaging Library for Android Wear

Related tags

App Teleport
Overview

Teleport - Data Sync & Messaging Library for Android Wear

Screen

Teleport is a library to easily setup and manage Data Syncronization and Messaging on Android Wearables.

The library is thought for Android Studio.

##Quick Overview

You can see Teleport as an Android Wear "plugin" you can add to your Activities and Services.

Teleport provides you commodity classes to easily establish a communication between a mobile handheld device and an Android Wear device.

  • TeleportClient provides you "endpoints" you can put inside your Activities, both in Mobile and Wear.
  • TeleportService is a full-fledged, already set-up 'WearableListenerService'.

Both these classes incapsulates all the GoogleApiClient setup required to establish a connection between Mobile and Wear.

TeleportClient and TeleportService also provide you two AsyncTask you can extend to easily perform operations with the synced DataItems and received Messages:

  • OnSyncDataItemTask provides you a complete DataMap of synced data
  • OnGetMessageTask provides you access to a received Message path in form of String.

You just need to extend these tasks inside your Activity/Service and you're good to go!

To Sync Data and send Messages, you can use commodity methods like

  • sync<ItemType>(String key, <ItemType> item) to Sync Data across devices
  • sendMessage(String path, byte[] payload) to send a Message to another device.

##Summary

##Can I have an example of how easy is Teleport to use?

There you go :-)

Here's a Mobile and a Wear Activity already configured to Sync Data.

  • The MobileActivity synchronizes a string "Hello, World!".
  • The WearActivity shows a Toast with the synchronized string.

###MobileActivity.java

    
    public class MobileActivity extends Activity {

    TeleportClient mTeleportClient;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_mobile);

             mTeleportClient = new TeleportClient(this);         
         }

        @Override
        protected void onStart() {
            super.onStart();
            mTeleportClient.connect();
            }

        @Override
        protected void onStop() {
            super.onStop();
            mTeleportClient.disconnect();
         }
    
  
        public void syncDataItem(View v) {                   
           //Let's sync a String!
           mTeleportClient.syncString("hello", "Hello, World!");   
        }
        
    }

###WearActivity.java

    public class WearActivity extends Activity {
    
        TeleportClient mTeleportClient;
        
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_wear);
    
             mTeleportClient = new TeleportClient(this);
             
             mTeleportClient.setOnSyncDataItemTask(new ShowToastHelloWorldTask());
             
        }
    
        @Override
        protected void onStart() {
            super.onStart();
            mTeleportClient.connect();
        }
    
        @Override
        protected void onStop() {
            super.onStop();
            mTeleportClient.disconnect();
    
        }
    
        public class ShowToastHelloWorldTask extends TeleportClient.OnSyncDataItemTask {
        
                @Override
                protected void onPostExecute(DataMap dataMap) {
        
                    String hello = dataMap.getString("hello");   
        
                    Toast.makeText(getApplicationContext(),hello,Toast.LENGTH_SHORT).show();
                }
        }
            
    }

Jump to Library Set Up !!!

##Follow me on Author: Mario Viviani Follow me on Google+ Follow me on LinkedIn

##Thanks to: Damien Cavaillès - https://github.com/thedamfr

##License

Teleport is released under the Apache License 2.0

Copyright 2014-2015 Mario Viviani

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
Comments
  • Exception in TeleportService

    Exception in TeleportService

    Sometimes I get Exception in TeleportService running on the wearable, usually it's happening when I install the app for the first time and launch it. Stacktrace:

    07-26 18:41:49.694 17549-17576/? E/AndroidRuntime﹕ FATAL EXCEPTION: WearableListenerService Process: cz.destil.wearsquare, PID: 17549 java.lang.IllegalStateException: Cannot execute task: the task is already running. at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:576) at android.os.AsyncTask.execute(AsyncTask.java:535) at com.mariux.teleport.lib.TeleportService.onDataChanged(TeleportService.java:70) at com.google.android.gms.wearable.WearableListenerService$a$1.run(Unknown Source) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.os.HandlerThread.run(HandlerThread.java:61) 07-26 18:41:49.874 17549-17549/? E/TeleportClient﹕ disconnect

    opened by davidvavra 31
  • RuntimeException sendMessage

    RuntimeException sendMessage

    Im trying to send sensor data as a string using the sendMessage method. For 2 sensors it worked fine, but when adding for 5 sensors types, i get this runtime error. I doesnt allow me to make any changes when trying to compile. When running the sensor collector on the wearable it keeps on getting the data but it also displays this runtime error. So it does work, but i dont know how to deal with this error.

    03-11 11:12:15.280 31002-31265/example.com.test W/Binder﹕ Caught a RuntimeException from the binder stub implementation. java.lang.IllegalStateException: Cannot execute task: the task is already running. at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:576) at android.os.AsyncTask.execute(AsyncTask.java:535) at com.mariux.teleport.lib.TeleportClient.onMessageReceived(TeleportClient.java:338) at com.google.android.gms.wearable.internal.bb.a(Unknown Source) at com.google.android.gms.wearable.internal.ae$a.onTransact(Unknown Source) at android.os.Binder.execTransact(Binder.java:404) at dalvik.system.NativeStart.run(Native Method) 03-11 11:12:15.300 31002-31021/example.com.aflgesturerecognition D/TeleportClient﹕ onMessageReceived() A message from watch was received:1640 ACCELEROMETER;4238107025104;0.07562256;-0.08029175;9.89003; 03-11 11:12:15.310 31002-31260/example.com.test D/TeleportClient﹕ onMessageReceived() A message from watch was received:1641 GYROSCOPE;0.0025939941;-5.0354004E-4;-4.4250488E-4; 03-11 11:12:15.330 31002-31013/example.com.test D/TeleportClient﹕ onMessageReceived() A message from watch was received:1642 GRAVITY;4238107025104;0.04632878;-0.035488866;9.806477; 03-11 11:12:15.340 31002-31014/example.com.test D/TeleportClient﹕ onMessageReceived() A message from watch was received:1643 LINEAR_ACCELERATION;0.029006232;-0.044582613;0.022687912; 03-11 11:12:15.370 31002-31014/example.com.test D/TeleportClient﹕ onMessageReceived() A message from watch was received:1644 ROTATION_VECTOR;-0.0018040044;-0.002366272;0.0022976713; 03-11 11:12:15.370 31002-31260/example.com.test D/TeleportClient﹕ onMessageReceived() A message from watch was received:1645 ACCELEROMETER;4238111663776;0.05419922;-0.027923584;9.89003; 03-11 11:12:15.370 31002-31260/example.com.test W/Binder﹕ Caught a RuntimeException from the binder stub implementation. java.lang.IllegalStateException: Cannot execute task: the task is already running. at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:576) at android.os.AsyncTask.execute(AsyncTask.java:535) at com.mariux.teleport.lib.TeleportClient.onMessageReceived(TeleportClient.java:338) at com.google.android.gms.wearable.internal.bb.a(Unknown Source) at com.google.android.gms.wearable.internal.ae$a.onTransact(Unknown Source) at android.os.Binder.execTransact(Binder.java:404) at dalvik.system.NativeStart.run(Native Method)

    opened by ghost 6
  • Does the usage of ASyncTask really necessary?

    Does the usage of ASyncTask really necessary?

    I decided to use this cool library. But when I saw ASyncTask, I said what is going on? Why do we need our own ASyncTask?

    Then, when I look at the internal code, I saw that doInBackground functions does not do anything at all. They just pass the parameter.

    opened by tasomaniac 3
  • No callbacks in service

    No callbacks in service

    Hi, version 1.1.2 brought a possibility to use callbacks instead of buggy AsyncTasks. But it's only possible for TeleportClient, not TeleportService. I need callbacks in Service, not Client, since I'm handling all incoming messages and data items in a service. So my original problem with Exceptions is not solved yet.

    opened by davidvavra 3
  • Example not working

    Example not working

    I forked the repo. I then copied the code at the "Can I have an example of how easy is Teleport to use?" The toasts are not showing up. I want to send a message to my phone from the wearable with some data. The example in the repo it shows it can send toast messages to the wear. Can you provide an example of sending messages from the wearable to the phone?

    opened by ghost 2
  • How to reuse a method with Teleport

    How to reuse a method with Teleport

    Hi,

    I want to send data when pressing a button from a wear to a handheld. With the following code it works the first time, but I have no idea how to reset the method. What do I have to code if I want to use the string several times?

    public void submit(View v) {
    
    
        String name = "2";
    
        //set the AsyncTask to execute when the Data is Synced
        mTeleportClient.setOnSyncDataItemTask(new ShowToastOnSyncDataItemTask());
    
        //Let's sync a String!
        mTeleportClient.syncString("name", name.toString());
    
    
    }
    

    and the method:

    //Task to show the String from DataMap with key "string" when a DataItem is synced
    public class ShowToastOnSyncDataItemTask extends TeleportClient.OnSyncDataItemTask {
    
        protected void onPostExecute(DataMap dataMap) {
    
            String s = dataMap.getString("name");
    
            Toast.makeText(getApplicationContext(),"DataItem - " +s,Toast.LENGTH_SHORT).show();
    
            mTeleportClient.setOnSyncDataItemTask(new ShowToastOnSyncDataItemTask());
        }
    }
    
    opened by kla4dj 2
  • TeleportClient onConnected() and disconnect() show debug messages as errors

    TeleportClient onConnected() and disconnect() show debug messages as errors

    Please replace Log.e with Log.d or Log.i in: https://github.com/Mariuxtheone/Teleport/blob/master/teleportlib/src/main/java/com/mariux/teleport/lib/TeleportClient.java since onConnected and disconnect are normal behaviors.

    opened by germanviscuso 2
  • Eclipse ADT

    Eclipse ADT

    Hi, I'm being forced to use the Eclipse ADT for the Mobile side of my comms (but still using Android Studio for the watch side). Is there any advice for using this library with the Eclipse ADT?

    Thanks, Dan

    opened by Danyc0 1
  • WearService

    WearService

    Hi there, I am trying to implement the "WearService"of the Teleport-master-App in my App, but it seems that I am missing the important part. I copied all the relevant codes into my App. Also tried to fully understand and minimize it on the Teleport-master side as well, to see what is really relevant. But as soon as I wanted to change names of the class "WearService" (Teleport-master-App) I saw that there might be missing an important part: The logcat says the following when renaming the class:

    java.lang.RuntimeException: Unable to instantiate service com.mariux.teleport.WearService: java.lang.ClassNotFoundException: Didn't find class "com.mariux.teleport.WearService" on path: DexPathList[[zip file "/data/app/com.mariux.teleport-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

    So whats the magic? :-)

    opened by kla4dj 1
  • Cannot execute task: the task has already been executed (a task can be executed only once)

    Cannot execute task: the task has already been executed (a task can be executed only once)

    Hi,

    using your awesome library (v0.1.3). Have problem, when I fire sendMessage second time from phone to watch. It crashes with:

        java.lang.IllegalStateException: Cannot execute task: the task has already been executed (a task can be executed only once)
                at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:579)
                at android.os.AsyncTask.execute(AsyncTask.java:535)
                at com.mariux.teleport.lib.TeleportService.onMessageReceived(TeleportService.java:309)
                at com.google.android.gms.wearable.WearableListenerService$a$2.run(Unknown Source)
                at android.os.Handler.handleCallback(Handler.java:733)
                at android.os.Handler.dispatchMessage(Handler.java:95)
                at android.os.Looper.loop(Looper.java:136)
                at android.os.HandlerThread.run(HandlerThread.java:61)
    

    Any idea how to fix this? Thanks!

    opened by ghost 1
  • Question about use Wear and Mobile Emulator

    Question about use Wear and Mobile Emulator

    I´m planning to use Teleport for communicate a mobile application with a wearable application. The first goal I´m trying to achieve is as simple as the first example you show in the README file of the project. But I´m not able to get it going. I´ve been debugging along the Teleport code and it seems that the applications are not communicating with each other because they are not paired or associated to the same session.

    Reading a little on the internet I saw that apparently the wear emulator can only communicate with a physical phone and not to another emulator.

    My question is: can I do that? can I communicate the wear android emulator to the mobile android emulator running both at the same time? Must I do something special to achieve this?

    Thanks in advance

    opened by vteferrer 1
  • Does this support images?

    Does this support images?

    Does this support sending and displaying images as well, or just strings? I know there is an issue with Android Wear and sending/receiving large files > 100kb.

    opened by tal32123 1
  • Crashing with Google Play Services 8.1.0

    Crashing with Google Play Services 8.1.0

    GPS 8.1.0 unfortunately did a breaking change and all libraries must update. Details:

    https://www.reddit.com/r/androiddev/comments/3mehbb/breaking_changes_in_google_play_services_81/

    opened by davidvavra 8
  • Send message from service

    Send message from service

    It is possible to receive a messages and open activities from a services. But can you also send a response message in a service. I want to be able to get data from the phone to the wearable, without the app being opened on the phone.

    opened by ghost 7
  • Something worth adding to the docs.

    Something worth adding to the docs.

    I have been struggling with this for a few days and recently solved my issue. The code wont work if the package applicationId's are different.

    applicationId "com.mariux.teleport" <- needs to be the same for both the wear app and the mobile app.

    This may be obvious to some, but kept me confused for ages. Perhaps some kind of note should be added to the documentation?

    opened by cameroncros 2
Owner
Mario Viviani
Mario Viviani
An MVP Dribbble client for Android Mobile, Tablet, Wear and TV.

Bourbon ![Sidebar] (https://img.shields.io/badge/Sidebar-06%2F05%2F2016-orange.svg) Bourbon is a simple Dribbble client built for Android Mobile, Wear

Joe Birch 1.1k Dec 12, 2022
A free and open-source offline authenticator app for Wear OS.

Wristkey Need 2FA codes quickly, right on your Wear watch without needing a phone? Wristkey is an open-source 2FA client for Wear OS watches that does

Owais Shaikh 80 Jan 4, 2023
HackerNews reader app for Wear OS

HNReader Install by importing to Android Studio, building the apk, and Google the official Android documentation for loading the apps to Wear OS and f

Hikmat Jafarli 2 Sep 4, 2022
Sync DND state between Android phone and watch

DNDSync This App was developed to enable Do Not Disturb (DND) synchronization between my Pixel phone and the Galaxy Watch 4 since this option was only

rhaeus 57 Jan 5, 2023
Android application to sync RSS without a server using DecSync

Flym DecSync Flym DecSync is a fork of Flym which adds synchronization using DecSync. To start synchronizing, all you have to do is synchronize your s

Aldo Gunsing 20 Dec 30, 2022
DAVx⁵ is an open-source CalDAV/CardDAV suite and sync app for Android.

DAVx⁵ Please see the DAVx⁵ Web site for comprehensive information about DAVx⁵. DAVx⁵ is licensed under the GPLv3 License. News and updates: @davx5app

bitfire web engineering 478 Dec 28, 2022
Sync floder from drive to local storage

GDrive #refrence and steps to upload - https://developers.google.com/drive/api/v3/manage-uploads to download - https://developers.goo

Karn_Rahul 0 Nov 4, 2021
A messaging social platform based on Discord for Desktop and Android.

AP-FinalProject A secure messaging social platform based on Discord for Desktop and Android. This is my final project for Advanced-Programming (AP) in

AmirHosseinAghajari 10 Oct 1, 2022
신경 - Cloud-native messaging/pubsub with powerful routing

신경 신경 /ɕʰinɡjʌ̹ŋ/ • sin-gyeong (try it with IPA Reader) nerve Nerve /nərv/ • noun (in the body) a whitish fiber or bundle of fibers that transmits imp

amy null 75 Dec 22, 2022
A simple, secure and instant messaging app. It's cloudbased and free.

Hasten A simple, secure and instant messaging application. It's cloudbased and free. Notice I'm probably at school right now and can't do much ?? . I'

Sliver Hywel 2 Sep 2, 2022
An easy to use android library to let devs know how much internet-data their app is consuming

EasyAnalytics! an easy to use android library to let developers know how much internet-data their app is consuming. We can identify this as we want ba

Sachin Rajput 13 Feb 21, 2022
To Do List App is built in Kotlin using Material 3, Data Binding, Navigation Component Graphs, Room persistence library, Kotlin coroutines, LiveData, Dagger Hilt, and Notifications following MVVM Architecture.

ToDoListApp ToDoList App demonstrates modern Android development with Hilt, Coroutines, LiveData, Jetpack (Room, ViewModel), and Material 3 Design bas

Naman Garg 10 Jan 8, 2023
Environmental-Monitoring-Android-App - This Android App is used to monitor environmental parameters data from remote sensors

Environmental-Monitoring-Android-App - This Android App is used to monitor environmental parameters data from remote sensors. Parameters includes but not limited to temperature, humidity, air quality, level of Ionizing radiation, ...

Francisco Pascal Elias TAMBASAFIDY 0 Jan 4, 2022
Read and write Android/data files on Android 13 without root

Android 13 (Tiramisu API 33) Read and write /Android/data or /Android/obb not need root Android 13 read and write /Android/data or /Android/obb withou

FolderV 59 Jan 4, 2023
HideDroid is an Android app that allows the per-app anonymization of collected personal data according to a privacy level chosen by the user.

HideDroid An Android App for preserving user privacy HideDroid is an Android app that allows the per-app anonymization of collected personal data acco

null 100 Dec 12, 2022
This android app fetches the data from the USGS API in real time to display a list of earthquakes.

This android app fetches the data from the USGS API in real time to display a list of earthquakes. On clicking an earthquake it opens a browser window with the complete information of the earthquake along with the location on a map.

null 5 Jan 11, 2022
An android application which uses HBO's Silicon Valley data (Mockable.io) for listing TV show episodes.

TVShowCaseApp An android application which uses HBO's Silicon Valley data (Mockable.io) for listing TV show episodes. Prerequisites 1. Check the API I

Çağatay Kölüş 1 Oct 26, 2021
Earthquake Android application for Indonesia region with data from BMKG

Awas Gempa Bumi Aplikasi yang menampilkan data gempa terbaru di Indonesia dengan sumber dari BMKG. Fitur : Menampilkan data gempa terbaru sesuai denga

Andrea 1 Aug 16, 2022