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

39
LINES

< > BotCompany Repo | #1002657 // Boot the boot program

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

Libraryless. Click here for Pure Java version (282L/3K/9K).

!752

import android.content.*; // Intent
import android.app.*; // Activity

static S serviceProgID = "#1002655";

p {
  Class serviceClass = Class.forName("de.tinybrain.javax_allperms.PermanentService");
  print("serviceClass: " + serviceClass);
  if (serviceClass == null) ret;
  
  Activity context = getAndroidContext();
  print("Context: " + context);
  
  context.startService(new Intent(context, serviceClass)); 
  print("Service should be started, looking for instance.");

  O service = null;
  for (int i = 0; i < 20*60; i++) { // 60 seconds
    sleep(50);
    service = get(serviceClass, "instance");
    if (service != null) break;
  }
  
  if (service == null) { print("woot no service?"); ret; }

  SharedPreferences prefs = cast call(service, "getSharedPreferences");
  S id = prefs.getString("serviceprogid", null);
  
  if (id == null) {
    print("No boot program registered.");
    return;
  }
  
  print("Boot program is " + id);
  print("Trying to boot it.");
  call(service, "boot");
}

Author comment

Began life as a copy of #1002656

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: #1002657
Snippet name: Boot the boot program
Eternal ID of this version: #1002657/1
Text MD5: fe26d84e0ed85d226371f0fb5393f9f8
Transpilation MD5: 88502ab93b2b7801913773939d63d3c3
Author: stefan
Category: javax
Type: JavaX source code (Android)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-02-10 02:22:15
Source code size: 1047 bytes / 39 lines
Pitched / IR pitched: No / No
Views / Downloads: 646 / 650
Referenced in: [show references]