Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4258434
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:38:55+00:00 2026-05-21T05:38:55+00:00

I want to send a request to some server just before the phone shuts

  • 0

I want to send a request to some server just before the phone shuts down. To do this, I will implement a BroadcastReceiver that receives the ACTION_SHUTDOWN broadcast. Upon reception of this broadcast the Service will fire an HttpRequest to some server.

I may not be able to verify if the server got the request since the phone has already shut down, but it doesn’t matter. My worry is if the window between broadcast to shutdown is enough for the service to send the request.

I looked around the internets and I found this:

#!/system/bin/sh
stop;
stop dhcpcd;

sleep 1;

for i in `cat /proc/mounts | cut -f 2 -d " "`;
do
   busybox mount -o remount,ro $i 2>&1 > /dev/null;
done

sync;

if [ "$1" = "-r" ];
then
   toolbox reboot;
fi

if [ "$1" = "-rr" ];
then
   toolbox reboot recovery;
else 
   reboot -p;
fi

here. The article states that this is the Android shutdown script. As we can see, dhcpcd is the first daemon that will be stopped upon shutdown. But still I don’t know if there will be enough time before the script executes.

So, is it possible to send an HttpRequest before the phone shuts down? If so, how?

EDIT: Assuming that a network connection is present, and the phone is turned off via normal means.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T05:38:56+00:00Added an answer on May 21, 2026 at 5:38 am

    Simply try it. Another way to do it could be simply to save the info you need on shutdown in a preference file (like shutdown time, …). Then on phone startup send this data to your server (and you have the bonus to be able to check that the server actually receives it and retry if unsuccessful).

    You can even imagine to do both as Send data after ACTION_SHUTDOWN is received suggests that there is time to send out some network data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to send a request to another server from my servlet and get
This is what I want to do: I want to send an HTTP request
I need to send a polling AJAX request to the server and send some
In my application I want to send a SOAP request to some url, the
I need to perform an ajax request to send some data server-side every time
I want to refresh Google Map and send new geolocalization request without refreshing the
I'm writing an Android application that I want to be able to send requests
Hello Sir i want send list of data to php server i use following
I want to send SQL server Dashboard & Health Report to my client on
I'm building a game server in Python and I just wanted to get some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.