Android Question Shutdown Intent Error

Calum Forsyth

Member
Licensed User
Hello,

We are currently using TomTom bridge devices for an application which will be deployed in trucks. When the ignition is powered down, I want the device to shutdown. As you can see on this link: https://developer.tomtom.com/bridge/develop/suspend-shutdown-hooks the device provides a shutdown intent.

When I try to call the intent ACTION_REQUEST_SHUTDOWN as displayed below, I get the error also shown below, even though I have added the permission in the manifest. The device doesn't show the permission under the application, but in the List Permission provided by B4A the permission is listed.

Does anybody know what I'm doing wrong?

B4X:
    Dim iintent As Intent
iintent.Initialize("android.intent.action.ACTION_REQUEST_SHUTDOWN","")
StartActivity(iintent)

Manifest
B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="19"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
AddPermission (android.permission.DEVICE_POWER)
AddPermission (android.permission.SHUTDOWN)
AddPermission (android.permission.CHANGE_NETWORK_STATE)
AddReceiverText (Starter,
<intent-filter android:priority="10">
  <action android:name="android.intent.action.ACTION_REQUEST_CONFIRM_SUSPEND_SHUTDOWN" />
  <category android:name="android.intent.category.DEFAULT" />
</intent-filter>
)
'End of default text.


java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.ACTION_REQUEST_SHUTDOWN flg=0x20000 cmp=android/com.android.server.ShutdownActivity } from ProcessRecord{418ae1f0 3948:webaspx.incab/u0a10061} (pid=3948, uid=10061) requires android.permission.SHUTDOWN

Thank You
 

Attachments

  • Manifest.PNG
    Manifest.PNG
    23.4 KB · Views: 348
Top