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
Forum slow
by
Curt Carpenter
[
Today
at 03:41:07 am]
Arabic text, problem on L...
by
Zaher
[
Today
at 03:29:16 am]
InstallAware Using Lazaru...
by
TRon
[
Today
at 02:55:41 am]
Generics - correct syntax
by
Blaazen
[
Today
at 01:57:40 am]
Demoscene The Champs Crac...
by
Gigatron
[
Today
at 01:05:16 am]
How to use the Event Log?
by
n7800
[
Today
at 12:47:25 am]
v3.99 code completion que...
by
440bx
[
Today
at 12:45:55 am]
FpDebug breakpoint on "be...
by
440bx
[
Today
at 12:36:23 am]
Access violation when re-...
by
TRon
[April 19, 2024, 11:44:51 pm]
[solved] how to get class...
by
jamie
[April 19, 2024, 11:34:44 pm]
Lazarus for Windows on aa...
by
Wallaby
[April 19, 2024, 10:52:25 pm]
Poll: Watches and Display...
by
440bx
[April 19, 2024, 07:13:51 pm]
Who is Indy mattias?
by
paweld
[April 19, 2024, 04:17:53 pm]
I just released a commerc...
by
BrassGear
[April 19, 2024, 03:17:28 pm]
Does anyone know why thes...
by
Laksen
[April 19, 2024, 03:04:14 pm]
Database standards OR Am ...
by
gidesa
[April 19, 2024, 02:37:56 pm]
How to: create DLL file f...
by
TRon
[April 19, 2024, 02:26:53 pm]
A fairly simple sound sol...
by
paweld
[April 19, 2024, 01:46:11 pm]
Access violation when ope...
by
Чебурашка
[April 19, 2024, 12:27:34 pm]
Step-into the field sette...
by
Martin_fr
[April 19, 2024, 11:31:48 am]
AI, NLP and CAI: Text Gen...
by
Dzandaa
[April 19, 2024, 11:03:26 am]
dwindows for Android
by
PierceNg
[April 19, 2024, 10:54:44 am]
create system unit from s...
by
Laksen
[April 19, 2024, 10:53:57 am]
[Solved] Find child contr...
by
Joanna
[April 19, 2024, 09:53:43 am]
FpDebug unexpected Assemb...
by
Marc
[April 19, 2024, 08:46:38 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: [LAMW] is it possible sending key to another android app (Read 1620 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