Skip to content

raquezha/hookr

Repository files navigation

Hookr (Kotlin)

I use this in my applications and I thought I just make it into a library.
Simple Utility that hook up your app to this external applications:

  1. Inbox (SMS)
  2. Phone
  3. Facebook Messenger
  4. Viber
  5. Whatsapp

This is usually used in Help/Support section where you link your app to external apps.

How to

Step 1. Add the JitPack repository to your build file Add it in your root build.gradle at the end of repositories:

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

Step 2. Add the dependency

dependencies {
  implementation "com.github.raquezha:hookr:1.2.0.2"
}

That's it! In case of a build failed, try cleaning or rebuilding your project. If all else fails try to Invalidate Cache and Restart option

Usage

var sampleNumber = "+639123456780"
var facebookId = "1231232131"

Inbox (SMS)

Hook.up(context).withSMS(sampleNumber)

Phone

Hook.up(context).withPhoneCall(sampleNumber)

Facebook Messenger

Hook.up(context).withMessenger(facebookId)

Can't find your facebook ID? use this: https://findmyfbid.com/

Viber

Hook.up(context).withViber(facebookId)

Whatsapp

Hook.up(context).withWhatsApp(facebookId)

Error Callback

In case something went wrong you can set a callback,
just call the lambda and it will be the error message.

Hook.up(context).withSMS(sampleNumber) {
  ...
  Log.e("Hookr", "error: $it")
}