File: call.py

package info (click to toggle)
python-plyer 2.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,808 kB
  • sloc: python: 13,395; sh: 217; makefile: 177
file content (29 lines) | stat: -rw-r--r-- 618 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
'''
Android Call
-----------
'''

from jnius import autoclass
from plyer.facades import Call
from plyer.platforms.android import activity

Intent = autoclass('android.content.Intent')
uri = autoclass('android.net.Uri')


class AndroidCall(Call):

    def _makecall(self, **kwargs):

        intent = Intent(Intent.ACTION_CALL)
        tel = kwargs.get('tel')
        intent.setData(uri.parse("tel:{}".format(tel)))
        activity.startActivity(intent)

    def _dialcall(self, **kwargs):
        intent_ = Intent(Intent.ACTION_DIAL)
        activity.startActivity(intent_)


def instance():
    return AndroidCall()