Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Operating Systems
»
Android
»
[LAMW] is it possible sending key to another android app
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
IRC channel
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
BUG REPORT: Unable to gen...
by
gasensor
[
Today
at 01:35:19 pm]
For-in loop over constant...
by
Joanna
[
Today
at 01:28:47 pm]
Lazarus for Windows on aa...
by
VisualLab
[
Today
at 01:27:12 pm]
The weird Rewrite bug
by
Kays
[
Today
at 01:23:40 pm]
FpDebug unexpected Assemb...
by
440bx
[
Today
at 12:54:43 pm]
Inherits forms and releas...
by
superc
[
Today
at 12:54:22 pm]
InstallAware Using Lazaru...
by
VisualLab
[
Today
at 12:34:43 pm]
Arabic text, problem on L...
by
Zaher
[
Today
at 12:34:05 pm]
RayLib 5.0
by
Guva
[
Today
at 11:25:40 am]
CocoaInt.CocoaIconUse no ...
by
MISV
[
Today
at 09:20:40 am]
Azure sql database will n...
by
paweld
[
Today
at 07:41:17 am]
Does anyone know why this...
by
TYDQ
[
Today
at 06:39:17 am]
TBGRABitmap.TextSize retu...
by
hedgehog
[
Today
at 06:07:46 am]
AI, NLP and CAI: Text Gen...
by
schuler
[
Today
at 04:26:36 am]
Demoscene Square dot flag...
by
KodeZwerg
[
Today
at 03:47:30 am]
How does Castle Game Eng...
by
michalis
[
Today
at 02:51:40 am]
Have anyone develop UEFI ...
by
440bx
[April 16, 2024, 09:39:52 pm]
Lazarus project made on M...
by
Odacir
[April 16, 2024, 08:56:58 pm]
Is it possible to support...
by
PascalDragon
[April 16, 2024, 08:51:36 pm]
CORBA interface and Varia...
by
PascalDragon
[April 16, 2024, 08:35:43 pm]
Macros confuse error mess...
by
PascalDragon
[April 16, 2024, 08:13:25 pm]
Form scaling
by
fxeconomist
[April 16, 2024, 08:09:39 pm]
Post your internal error ...
by
Eugene Loza
[April 16, 2024, 07:12:35 pm]
C-evo: New Horizons 1.3.0...
by
Chronos
[April 16, 2024, 06:32:41 pm]
How can i make this windo...
by
Handoko
[April 16, 2024, 06:23:43 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: [LAMW] is it possible sending key to another android app (Read 1583 times)
Mongkey
Sr. Member
Posts: 430
[LAMW] is it possible sending key to another android app
«
on:
February 28, 2021, 04:15:04 am »
Any idea?
«
Last Edit: February 28, 2021, 04:23:04 am by Mongkey
»
Logged
ASBzone
Hero Member
Posts: 678
Automation leads to relaxation...
Re: [LAMW] is it possible sending key to another android app
«
Reply #1 on:
February 28, 2021, 04:54:25 am »
You may need to be a bit more verbose in what you are requesting, and what you are already experiencing when you try to accomplish it.
Logged
-ASB:
https://www.BrainWaveCC.com/
Lazarus v2.2.7-ada7a90186 / FPC v3.2.3-706-gaadb53e72c
(Windows 64-bit install w/Win32 and Linux/Arm cross-compiles via FpcUpDeluxe on both instances)
My Systems: Windows 10/11 Pro x64 (Current)
Mongkey
Sr. Member
Posts: 430
Re: [LAMW] is it possible sending key to another android app
«
Reply #2 on:
February 28, 2021, 01:31:58 pm »
I just want to send / inject whatsapp activity with enter key, after opening whatsapp intent, so the message automatically sent without touching send button.
Logged
Mongkey
Sr. Member
Posts: 430
Re: [LAMW] is it possible sending key to another android app
«
Reply #3 on:
February 28, 2021, 01:36:37 pm »
I want to integrate whatsapp, as appointment reminder by sending whatsapp message automatically without doing 1 by 1 . Thank you for your reply ABSzone.
This screenshots are what i did so far with awesome LAMW.
«
Last Edit: March 01, 2021, 01:52:40 am by Mongkey
»
Logged
jmpessoa
Hero Member
Posts: 2301
Re: [LAMW] is it possible sending key to another android app
«
Reply #4 on:
February 28, 2021, 06:33:29 pm »
Hi, Mongkey...
Look for some pure java/android example and you will learn what intent parameters you need....
Logged
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard
Mongkey
Sr. Member
Posts: 430
Re: [LAMW] is it possible sending key to another android app
«
Reply #5 on:
March 01, 2021, 01:29:18 am »
all i did just learning from LAMW samples, pure java just like an alien for me
, opening WA intent -> put some text -> start intent -> pressing OK, i just need set auto pressing for OK/ENTER button, (hi hi hi, this just like what appium do)
Thanks for your reply JMPessoa,
I found many intent parameters here:
https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/res/AndroidManifest.xml#L2515
I think i need more coffee to accomplish this, for pull stuck type programmer like me, thank you.
«
Last Edit: March 01, 2021, 01:43:21 am by Mongkey
»
Logged
Segator
Full Member
Posts: 168
Re: [LAMW] is it possible sending key to another android app
«
Reply #6 on:
March 01, 2021, 04:29:53 pm »
Hi, Mongkey, i think that you need an special android 8.0> function that interact with touch screen, this require special permission and is not recomended for securoty reason, try to find the correct Intent params to do that like @jmpessoa say, this is an java example from
https://stackoverflow.com/questions/19081654/send-text-to-specific-contact-programmatically-whatsapp
Code: Pascal
[Select]
[+]
[-]
PackageManager packageManager
=
context
.
getPackageManager
(
)
;
Intent i
=
new
Intent
(
Intent
.
ACTION_VIEW
)
;
try
{
String url = "https://api.whatsapp.com/send?phone="+ phone +"&text=" + URLEncoder.encode(message, "UTF-8");
i.setPackage("com.whatsapp");
i.setData(Uri.parse(url));
if (i.resolveActivity(packageManager) != null) {
context.startActivity(i);
}
}
catch
(
Exception e
)
{
e.printStackTrace();
}
and you can adapt to the pascal lamw way like this (not tested):
Code: Pascal
[Select]
[+]
[-]
procedure
TAndroidModule1
.
jButton1Click
(
Sender
:
TObject
)
;
var
phone
,
message
:
string
;
begin
phone
:
=
'12345678'
;
message
:
=
'I am the body.'
;
jIntentManager1
.
SetAction
(
iaSENDTO
)
;
jIntentManager1
.
SetDataUri
(
self
.
ParseUri
(
'https://api.whatsapp.com/send?phone='
+
phone
+
'&text='
+
self
.
UriEncode
(
message
)
)
)
;
jIntentManager1
.
SetDataAndType
(
self
.
ParseUri
(
'https://api.whatsapp.com/send?phone='
+
phone
+
'&text='
+
self
.
UriEncode
(
message
)
)
,
'text/plain'
)
;
jIntentManager1
.
SetPackage
(
'com.whatsapp'
)
;
jIntentManager1
.
StartActivity
(
)
end
;
Logged
i am Reinier, Nenirey and Segator
https://github.com/Nenirey
Mongkey
Sr. Member
Posts: 430
Re: [LAMW] is it possible sending key to another android app
«
Reply #7 on:
March 02, 2021, 01:18:38 am »
thanks, segator,
IaSENDTO not working on my android 10 handset, only IaVIEW does the job, am i missing something?
IaSEND working code:
Code: Pascal
[Select]
[+]
[-]
var
phone
,
message
:
string
;
begin
phone
:
=
'62123456'
;
message
:
=
'I am the body.'
;
if
jIntentManager1
.
IsPackageInstalled
(
'com.whatsapp'
)
then
begin
jIntentManager1
.
SetPackage
(
'com.whatsapp'
)
;
jIntentManager1
.
SetAction
(
IaSEND
)
;
jIntentManager1
.
SetMimeType
(
'text/plain'
)
;
jIntentManager1
.
SetFlag
(
ifActivityNewTask
)
;
jIntentManager1
.
PutExtraText
(
message
)
;
//jIntentManager1.SetDataUri(self.ParseUri('https://api.whatsapp.com/send?phone='+ phone +'&text=' + self.UriEncode(message)));
//jIntentManager1.PutExtraString('Jid', phone +'@s.whatsapp.net');
jIntentManager1
.
StartActivity
(
)
end
«
Last Edit: March 02, 2021, 02:44:53 am by Mongkey
»
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Operating Systems
»
Android
»
[LAMW] is it possible sending key to another android app
TinyPortal
© 2005-2018