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
Offical launch of the 1 B...
by
Gustavo 'Gus' Carreno
[
Today
at 12:50:46 am]
what to do if my target M...
by
Laksen
[
Today
at 12:49:12 am]
For-in loop over constant...
by
ASerge
[
Today
at 12:36:09 am]
Converting a string/index...
by
TRon
[April 18, 2024, 11:56:37 pm]
exclude ALL packages from...
by
PascalDragon
[April 18, 2024, 11:33:29 pm]
Demoscene The Champs Crac...
by
KodeZwerg
[April 18, 2024, 11:29:50 pm]
Poll: Watches and Display...
by
440bx
[April 18, 2024, 10:55:14 pm]
Database standards OR Am ...
by
dseligo
[April 18, 2024, 10:50:26 pm]
BUG REPORT: Unable to gen...
by
PascalDragon
[April 18, 2024, 10:24:23 pm]
How to: create DLL file f...
by
paule32
[April 18, 2024, 10:23:59 pm]
Have anyone develop UEFI ...
by
PascalDragon
[April 18, 2024, 10:14:15 pm]
Lazarus for Windows on aa...
by
PascalDragon
[April 18, 2024, 10:09:10 pm]
The weird Rewrite bug
by
PascalDragon
[April 18, 2024, 09:58:53 pm]
Assign (textfile) not com...
by
PascalDragon
[April 18, 2024, 09:51:50 pm]
Question for people who h...
by
PascalDragon
[April 18, 2024, 09:44:32 pm]
Linux Workspaces -- StayO...
by
AmatCoder
[April 18, 2024, 08:34:20 pm]
I just released a commerc...
by
Seenkao
[April 18, 2024, 07:57:21 pm]
Access violation when re-...
by
TRon
[April 18, 2024, 07:37:31 pm]
[SOLVED] assembler name i...
by
TRon
[April 18, 2024, 07:26:33 pm]
A fairly simple sound sol...
by
KodeZwerg
[April 18, 2024, 07:01:52 pm]
Step-into the field sette...
by
Martin_fr
[April 18, 2024, 06:54:19 pm]
[Fun Fact] PNG and Micros...
by
Ten_Mile_Hike
[April 18, 2024, 06:24:19 pm]
HTTP/2+HTTP/1.1+WebSocket...
by
iLya2IK
[April 18, 2024, 06:14:30 pm]
Improvement of TFPTimerTh...
by
AlexTP
[April 18, 2024, 05:56:38 pm]
Arabic text, problem on L...
by
nouzi
[April 18, 2024, 05:21:27 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: [LAMW] is it possible sending key to another android app (Read 1598 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