0

I am learning Anko commons and in that, I see Intent for easy to write code to startActivity. It's working. But in that I see Anko has call wrappers for some widely used Intents:

Goal                 Solution
------------         -------------------
Make a call          makeCall(number) without tel:
Send a text          sendSMS(number, [text]) without sms:
Browse the web       browse(url)
Share some text      share(text, [subject])
Send a email         email(email, [subject], [text])

So I want to use this wrapper but don't know how. How can I use this?

Reference Like: https://github.com/Kotlin/anko/wiki/Anko-Commons-%E2%80%93-Intents#useful-intent-callers

@9spl what you have written in the answer I know that all and I have used the latest dependency but my first question was how to use makeCall(). But I got that answer how to use then I have another problem, makeCall() doesn't work. I have declared permission in manifest although it's not working. why?

sendSMS() and browse() both are working but makeCall() is not working.

piet.t
  • 11,718
  • 21
  • 43
  • 52
Patel Pinkal
  • 8,984
  • 4
  • 28
  • 50
  • 1
    Include Anko (`compile "org.jetbrains...."`) and call one of these functions from `Activity` (while not in Activity, you can specify it explicitly, e. g. `activity.browse(...)`). – Miha_x64 Jun 23 '17 at 12:25
  • yes, it's working. Thanks. But one more problem when I use `makeCall()` it doesn't work. why? – Patel Pinkal Jun 23 '17 at 12:39
  • What happens when you call `makeCall()`? Are there any logs? – Bryan Jun 23 '17 at 12:45

2 Answers2

1

just make sure you have added right dependency for anko in your app gradle

compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.2-3"

compile "org.jetbrains.anko:anko-commons:0.10.0"

Now it is so easy to use it use this as a functions of Anko Ex.if you want to make call just simply call this function like

makeCall("PHONE_NUMBER")

9spl
  • 357
  • 1
  • 11
0

You need to add CALL_PHONE permission i.e <uses-permission android:name="android.permission.CALL_PHONE"/> in the Manifest file and also ask the user for run-time CALL_PHONE permission.