Skip to content
Snippets Groups Projects
Select Git revision
  • ae81d2d2cd6abae480506263ff84a2e76f09cd2b
  • master default protected
2 results

Dialer.java

Blame
  • Dialer.java 877 B
    /*
     * This file and the enclosing package folders must be symlinked into the p4a dist's src folder.
     *
     * For example, if you are building for x86, you might run
     *
     * $ ln -s ~/PycharmProjects/intents/edu ~/.local/share/python-for-android/dists/x86/src/edu
     *
     */
    
    package edu.unl.cse.soft161;
    
    import org.kivy.android.PythonActivity;
    import android.content.Intent;
    import android.net.Uri;
    import android.app.Activity;
    
    public class Dialer {
        public static boolean dial(String phoneNumber) {
            Intent intent = new Intent();
            intent.setAction(Intent.ACTION_DIAL);
            intent.setData(Uri.parse("tel:" + phoneNumber));
    
            Activity activity = PythonActivity.mActivity;
            if (intent.resolveActivity(activity.getPackageManager()) != null) {
                activity.startActivity(intent);
                return true;
            }
            return false;
        }
    }