Hosein_Mghr
Member
I have a project that needs to enable auto-start by the user and check that auto-start is enabled
Asking to enable autostart works fine but I can't figure out if autostart is enabled or not
I used the following Sub to get auto launch permission
:
I used the following codes to check the activation of automatic startup:
No output is received after enabling automatic startup in the AutoStart server. Does anyone have a solution for this problem?
please help. With respect,
Asking to enable autostart works fine but I can't figure out if autostart is enabled or not
I used the following Sub to get auto launch permission
:
Sub CheckAppAutoStartSomeDevice:
Sub CheckAppAutoStartSomeDevice
Try
Dim p As Phone
Dim manufacturer As String = p.Manufacturer
Dim Intent As Intent
Intent.Initialize("","")
Dim GotoSetting As Boolean =False
If manufacturer.EqualsIgnoreCase("xiaomi") Then
Intent.SetComponent("com.miui.securitycenter/com.miui.permcenter.autostart.AutoStartManagementActivity") : GotoSetting=True
else If manufacturer.EqualsIgnoreCase("vivo") Then
Intent.SetComponent("com.vivo.permissionmanager/com.vivo.permissionmanager.activity.BgStartUpManagerActivity") : GotoSetting=True
else If manufacturer.EqualsIgnoreCase("Letv") Then
Intent.SetComponent("com.letv.android.letvsafe/com.letv.android.letvsafe.AutobootManageActivity") : GotoSetting=True
else If manufacturer.EqualsIgnoreCase("Honor") Then
Intent.SetComponent("com.huawei.systemmanager/com.huawei.systemmanager.optimize.process.ProtectActivity") : GotoSetting=True
else If manufacturer.EqualsIgnoreCase("oppo") Then
Intent.SetComponent("com.coloros.safecenter/com.coloros.safecenter.permission.startup.StartupAppListActivity") : GotoSetting=True
End If
If GotoSetting Then
Dim pm As PackageManager
Dim list As List = pm.QueryIntentActivities(Intent)
If list.Size > 0 Then
Msgbox2Async("Please enable auto-start. ", "","Go To Setting ", "", "", Null, False)
Wait For Msgbox_Result (Result As Int)
If Result = DialogResponse.POSITIVE Then
StartActivity(Intent)
End If
End If
End If
Catch
Log(LastException)
End Try
End Sub
I used the following codes to check the activation of automatic startup:
manifest:
AddPermission(android.permission.RECEIVE_REPLACED_PACKAGE)
AddReceiverText(AutoStart, <intent-filter> <action android:name="android.intent.action.PACKAGE_REPLACED" /> <category android:name="android.intent.category.DEFAULT" /></intent-filter>)
AutoStart Service:
Sub Process_Globals
Dim BroadCast As BroadCastReceiver
End Sub
Sub Service_Create
BroadCast.Initialize("Receiver")
Broadcast.addAction("android.intent.action.PACKAGE_REPLACED")
BroadCast.AddCategory("android.intent.category.DEFAULT")
Broadcast.SetPriority(2147483647)
Broadcast.registerReceiver("")
End Sub
Sub Service_Start (StartingIntent As Intent)
Log("Service Start....")
End Sub
Sub Receiver_OnReceive (Action As String )
Log("Action :" &Action, True)
End Sub
Sub Service_Destroy
End Sub
No output is received after enabling automatic startup in the AutoStart server. Does anyone have a solution for this problem?
please help. With respect,