Boot into specific Hangout with one person


Question

I would like my tablet to boot up into the Google Hangouts app, and open the conversation with a specific person.



I'm able to open the Hangouts app easily with this app (or one of the many like it), but I need to open the conversation and this leaves me at the list of people page.



Resources that haven't quite gotten me there:



Similar question on Reddit



Similar discussion for the Tasker app



YouTube tutorial



When I try to use AutoContacts and log the %achangouturi variable it doesn't work. Many people say they needed to enable contacts syncing in G+, but the menus have changed and it does not work. That's the most common issue. But it's not mine.



Using the Automate app I was able to finally log the URI for the contact, and therefore have a unique ID with which I can one day hopefully open a conversation.



The way I got it was by using "Pick Contact", setting the output variable to contactURI, and then using log to log { contactUri } .



However, I am not able to open the hangout chat yet.



Using Automate, I choose launch app and choose hangouts.



I've tried using:




  • ACTION: android.intent.action.VIEW

  • DATA: content://com.android.contacts/data/xxxx


    • as well as DATA: content://com.android.contacts/contacts.lookup/xxxx


  • MIME TYPE: vnd.android.cursor.item/vnd.googleplus.profile.comm



In the Reddit answer, I don't understand and can't find the options to set the flags he did in either Tasker or Automate:



FLAGS: FLAG_ACTIVITY_FORWARD_RESULT FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET FLAG_ACTIVITY_PREVIOUS_IS_TOP



I've also tried using and not using com.google.android.talk - com.google.android.apps.babel.phone.BabelProfileActionActivity in the activity field.


Answer

I have done this using tasker. You are completely on the right track, instructions below.



SQL to find contact ID



Find the unique contact ID from the contacts database (which it seems you have already done). In case you have the wrong ID you can check with the SQL instructions. I had a few issues with this given I was only entering the first name when looking for the contact, and for some reason it wasn't being found. Anyway, this SQL query should work on the file: /data/data/com.android.providers.contacts/databases/contacts2.db



You can use a SQL app/program, browse to that file, and enter the SQL query:



SELECT _id FROM data WHERE raw_contact_id LIKE (SELECT _id from raw_contacts WHERE display_name LIKE "Contact Name" ORDER BY _id DESC LIMIT 1) AND DATA4 LIKE "10" ORDER BY _id DESC LIMIT 1


Or you can enter this command into the terminal provided you have sqlite3 on your specific device (often not included in production release devices):



sqlite3 /data/data/com.android.providers.contacts/databases/contacts2.db 'SELECT _id FROM data WHERE raw_contact_id LIKE (SELECT _id from raw_contacts WHERE display_name LIKE "Contact Name" ORDER BY _id DESC LIMIT 1) AND DATA4 LIKE "10" ORDER BY _id DESC LIMIT 1' | sed s/\"//g


Just replace "Contact Name" and put the contact you want to open inside the quotes. The full contact name preferably.



Unrooted phone



I was working on a solution for this, but app backup is explicitly disabled in the contacts app manifest. Try the solution below and let me know if it works. I wasn't able to test it without root.



Install Tasker and AutoContacts. AutoContacts is paid, but you can get a in the next 15 minutes after buying the full version if you just want to test it.



Setup a task in tasker, name it, then add a new action Plugin > AutoContacts > AutoContacts. Then in the configuration type in "Contact Name or Nickname" the name of the desired contact. Press the tick. Press the back button in Tasker to get back to the list of actions for that task (you will have 1 now). Add a new action Alert > Flash. Press the button on the right of "text" that looks like a label and select "Autocontacts: 01. Hangout Uri ... %achangouturi". Press back to go to the action list. Press back again to save the task. Go back into the task and run it. The ID that you need for the contact you want will be at the end of the string that flashes up and will usually be 5 digits long. Run the task again if you didn't catch it in time.



Creating Tasker task



Once you have the ID copied down, you need to go into Tasker to create the task that will open hangouts to the conversation. You have the right idea to use an intent, it is just a little different from what you already have. In the new task create a new action "+" select System > Send Intent. Create the intent in the following format:



Action: android.intent.action.VIEW
Cat: None
Mime Type: Leave blank
Data: content://com.android.contacts/data/#####
Extras/package/class: Leave blank
Target: Activity


Where ##### is the contact ID you found earlier. Mine were all 5 digits long.



Now you should be able to use this task for whatever your heart desires. Give it a test by pressing the play button in the task in Tasker.



A quick note, I mainly use mine in conjunction with AutoVoice in order to open a message I just got sent. I found it very useful to be able to launch hangouts back to the main screen and actually found this quite difficult as the Tasker "kill app" wasn't completely restarting hangouts. I found the way to do this is create an action "Launch App" and select the "Always launch a new copy" checkbox. This will always open hangouts to the main threads list.



Most of this is from this Google Groups discussion. Good luck, let me know if you run into any troubles.


Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes