| 1 | ''' |
| 2 | Android Call |
| 3 | ----------- |
| 4 | ''' |
| 5 | |
| 6 | from jnius import autoclass |
| 7 | from plyer.facades import Call |
| 8 | from plyer.platforms.android import activity |
| 9 | |
| 10 | Intent = autoclass('android.content.Intent') |
| 11 | uri = autoclass('android.net.Uri') |
| 12 | |
| 13 | |
| 14 | class AndroidCall(Call): |
| 15 | |
| 16 | def _makecall(self, **kwargs): |
| 17 | |
| 18 | intent = Intent(Intent.ACTION_CALL) |
| 19 | tel = kwargs.get('tel') |
| 20 | intent.setData(uri.parse("tel:{}".format(tel))) |
| 21 | activity.startActivity(intent) |
| 22 | |
| 23 | def _dialcall(self, **kwargs): |
| 24 | intent_ = Intent(Intent.ACTION_DIAL) |
| 25 | activity.startActivity(intent_) |
| 26 | |
| 27 | |
| 28 | def instance(): |
| 29 | return AndroidCall() |