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
JEDI error but unit compi...
by
DomingoGP
[
Today
at 08:28:17 am]
Configure JCF messages
by
DomingoGP
[
Today
at 08:19:10 am]
Any upgrades to fpWeb pag...
by
AlexTP
[
Today
at 08:10:55 am]
Zeos components. Had to c...
by
dbannon
[
Today
at 07:26:11 am]
IDE instability on Raspbe...
by
rvk
[
Today
at 07:08:49 am]
A button require administ...
by
Fibonacci
[
Today
at 05:57:21 am]
Using KeyPress event, how...
by
Joanna
[
Today
at 03:07:47 am]
How to detect one externa...
by
d2010
[
Today
at 12:24:32 am]
Center Lost Window featur...
by
Tony Stone
[
Today
at 12:06:16 am]
Complex package installat...
by
wp
[March 27, 2024, 10:47:45 pm]
Controlling the behavior ...
by
wp
[March 27, 2024, 10:43:40 pm]
A "leisure" question on W...
by
EventHorizon
[March 27, 2024, 10:18:38 pm]
need advice about the fol...
by
jamie
[March 27, 2024, 09:56:39 pm]
[SOLVED] Completion box s...
by
Martin_fr
[March 27, 2024, 08:44:09 pm]
Dialog ShowModal and an i...
by
d7_2_laz
[March 27, 2024, 08:25:18 pm]
Offical launch of the 1 B...
by
Gustavo 'Gus' Carreno
[March 27, 2024, 07:41:48 pm]
Your best UI design - con...
by
hrayon
[March 27, 2024, 06:42:28 pm]
Understanding and adjusti...
by
ArchChem
[March 27, 2024, 06:04:25 pm]
Problem setting length of...
by
Remy Lebeau
[March 27, 2024, 05:41:10 pm]
TDBLookupcombobox seems u...
by
Fantablup
[March 27, 2024, 05:18:04 pm]
Poll: Watches and Display...
by
Martin_fr
[March 27, 2024, 03:58:57 pm]
STARS with line border st...
by
Boleeman
[March 27, 2024, 02:37:39 pm]
Help needed with Cairo / ...
by
AL
[March 27, 2024, 02:35:10 pm]
I encountered onDatachang...
by
Fantablup
[March 27, 2024, 02:34:08 pm]
Code folding tree — highl...
by
Martin_fr
[March 27, 2024, 01:58:19 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: [LAMW] is it possible sending key to another android app (Read 1558 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: 2297
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