Libraryless. Click here for Pure Java version (893L/7K/21K).
1 | !752 |
2 | |
3 | import android.content.*; // Intent |
4 | import android.app.*; // Activity |
5 | |
6 | p { |
7 | Class serviceClass = Class.forName("de.tinybrain.javax_allperms.PermanentService"); |
8 | print("serviceClass: " + serviceClass); |
9 | if (serviceClass == null) ret; |
10 | |
11 | Activity context = getAndroidContext(); |
12 | print("Context: " + context); |
13 | |
14 | context.startService(new Intent(context, serviceClass)); |
15 | print("Service should be started, looking for instance."); |
16 | |
17 | O service = null; |
18 | for (int i = 0; i < 20*60; i++) { // 60 seconds |
19 | sleep(50); |
20 | service = get(serviceClass, "instance"); |
21 | if (service != null) break; |
22 | } |
23 | |
24 | if (service == null) { print("woot no service?"); ret; } |
25 | |
26 | Thread thread = new Thread("Phone Bot") { |
27 | public void run() { |
28 | for (int i = 0; i < 3; i++) { |
29 | sayInWebChat("Phone Bot", "I am running on Android! " + unixSeconds()); |
30 | sleepSeconds(60); |
31 | } |
32 | } |
33 | }; |
34 | |
35 | call(service, "addThread", thread); |
36 | |
37 | print("Thread added! Check web chat..."); |
38 | } |
Began life as a copy of #1002649
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, nbgitpuheiab, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1002651 |
Snippet name: | Android: Try to start the JavaX service and add a web chat bot to it |
Eternal ID of this version: | #1002651/1 |
Text MD5: | d090e60e2c308fe1fa645f7d1d3895fd |
Transpilation MD5: | 8f9670b8f7b15a89f787cba75cbf45ce |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (Android) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-02-09 21:58:18 |
Source code size: | 1028 bytes / 38 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 519 / 543 |
Referenced in: | [show references] |