How to send SMS in android?
-
Hi,
Did you try to look up the Android API ? A quick search turns out SmsManager.
-
Use Qt Android Extras helpers. Also you can read about here (from first to last episode).
-
@Mikeeeeee , you can write a java class which contains the function to send the sms, and after that you can use the QtAndroid and QAndroidJniEnvironment in your cpp class and call the function defined in your java class.
Something like this:-QtAndroid::androidActivity().callMethod<void>("sendSMS");
I had used "textLocal" (sms platform) in a project i was working on and it worked really nice, so they have few API's which you can make use of.If you want the code for that please have a look at this[http://api.textlocal.in/docs/sendsms].
For more information about QtAndroid[https://doc.qt.io/qt-5/qtandroid.html] and QAndroidJniEnvironment[https://doc.qt.io/qt-5/qandroidjnienvironment.html]
-
Hi @Mikeeeeee , you need to add like this:-
android: QT += androidextras
-
Might be a silly question but are you building that with your Qt Android kit ?
-
That has nothing to do with your error. You were using a Qt build that was not for Android, likely your desktop build.
MinGW is unrelated to the Qt Android version. The compiler is provided by the Android NDK.
-
@Mikeeeeee Take a look at https://doc.qt.io/qt-5/qandroidjniobject.html
-
@Mikeeeeee said in How to send SMS in android?:
Will this option work
Have you already tried? Trial and error is a way to learn...
-
QAndroidJniObject testSms; testSms.callMethod< jint > ("createAppSpecificSmsTokenWithPackageInfo(32133)");
With the warning that I know absolutely nothing about this:
You are using the overload https://doc.qt.io/qt-5/qandroidjniobject.html#callMethod,
callMethod(const char *methodName)
. It may well be thatmethodName
has to be a method name,"createAppSpecificSmsTokenWithPackageInfo(32133)"
is a full function call. You may have to use overload https://doc.qt.io/qt-5/qandroidjniobject.html#callMethod-1,callMethod(const char *methodName, const char *sig, ...)
, and specify the function signature and pass32133
as parameter, in order to call functions with parameters?Have you/can you test if you can call a method which does not take any parameters, does that work OK?
-