Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2017-06

using Android SmsManager APIs from Lazarus

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

duilio foschi

I could compile my first Lazarus "hello world" application for Android.

When I click a button on screen, the message "hello world" is displayed.

So far so good.

Now I'd like to make things harder.

When I click the same button on screen, I want text "hello world" be sent to a predefined mobile number using Android APIs.

I found this example... It seems easy...but it is no pascal!

>>>>

public void sendSMS(String phoneNo, String msg) {
try {

        SmsManager smsManager = SmsManager.getDefault();
        smsManager.sendTextMessage(phoneNo, null, msg, null, null);
        Toast.makeText(getApplicationContext(), "Message Sent",
              Toast.LENGTH_LONG).show();
    } catch (Exception ex) {
        Toast.makeText(getApplicationContext(),ex.getMessage().toString(),
              Toast.LENGTH_LONG).show();
        ex.printStackTrace();
    }

}

<<<<<<

Is there a way to use Android APIs from Lazarus ?

Thank you

Peppe Polpo

Reply by email