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
How to get along with the...
by
BrassGear
[
Today
at 01:24:31 pm]
Spiral of Theodorus: Reve...
by
Roland57
[
Today
at 01:24:14 pm]
I just released a commerc...
by
BrassGear
[
Today
at 01:20:51 pm]
create system unit from s...
by
Key-Real
[
Today
at 01:14:09 pm]
InstallAware Using Lazaru...
by
dbannon
[
Today
at 01:05:38 pm]
Improvement of TFPTimerTh...
by
lagprogramming
[
Today
at 12:53:29 pm]
Assign (textfile) not com...
by
Thaddy
[
Today
at 12:18:09 pm]
Question for people who h...
by
marcov
[
Today
at 12:04:56 pm]
[SOLVED] assembler name i...
by
Laksen
[
Today
at 11:40:43 am]
Warning: Source OS Redefi...
by
Laksen
[
Today
at 11:32:46 am]
[SOLVED] how to see what ...
by
Laksen
[
Today
at 11:30:25 am]
Slow copying of small str...
by
alpine
[
Today
at 11:25:10 am]
How to: create DLL file f...
by
KodeZwerg
[
Today
at 10:53:20 am]
Text orientation in TMemo...
by
wp
[
Today
at 10:27:54 am]
Linux Workspaces -- StayO...
by
AmatCoder
[
Today
at 08:21:27 am]
Demoscene The Champs Crac...
by
Lulu
[
Today
at 08:15:12 am]
Azure sql database will n...
by
paweld
[
Today
at 07:24:47 am]
Find child controls by na...
by
Handoko
[
Today
at 04:17:05 am]
location of non visual co...
by
VisualLab
[April 17, 2024, 11:58:55 pm]
For-in loop over constant...
by
Joanna
[April 17, 2024, 11:57:15 pm]
Lazarus editor feature re...
by
440bx
[April 17, 2024, 11:49:08 pm]
How would you define a fi...
by
wp
[April 17, 2024, 11:04:00 pm]
Directx9 with mylogo insi...
by
KodeZwerg
[April 17, 2024, 11:03:54 pm]
Lazarus for Windows on aa...
by
Wallaby
[April 17, 2024, 10:25:46 pm]
[SOLVED] TDbf table, Leve...
by
1HuntnMan
[April 17, 2024, 10:03:16 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: [LAMW] is it possible sending key to another android app (Read 1587 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