Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

26
LINES

< > BotCompany Repo | #1002649 // Android: Try to start PermanentService

JavaX source code (Android) [tags: use-pretranspiled] - run with: the app

Libraryless. Click here for Pure Java version (272L/2K/8K).

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  
  // use this to start and trigger a service
12  
  
13  
  Activity context = getAndroidContext();
14  
  print("Context: " + context);
15  
  
16  
  Intent i = new Intent(context, serviceClass);
17  
  context.startService(i); 
18  
  
19  
  print("Service started?");
20  
21  
  print("Instance: " + get(serviceClass, "instance"));
22  
  
23  
  sleepSeconds(5);
24  
  
25  
  print("Instance: " + get(serviceClass, "instance"));
26  
}

Author comment

Began life as a copy of #1002648

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: #1002649
Snippet name: Android: Try to start PermanentService
Eternal ID of this version: #1002649/1
Text MD5: 639a8f2236498aa571ed4de2499baa03
Transpilation MD5: 5c7dd383c756b3293777e8eadee378ca
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:38:43
Source code size: 640 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 551 / 579
Referenced in: [show references]