Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package dgameman1.com.emojiupdaterroot;
- import android.app.AlertDialog;
- import android.app.DownloadManager;
- import android.content.BroadcastReceiver;
- import android.content.Context;
- import android.content.DialogInterface;
- import android.content.Intent;
- import java.io.IOException;
- public class DownloadBroadcastReceiver extends BroadcastReceiver {
- @Override
- public void onReceive(Context context, Intent intent) {
- String action = intent.getAction();
- if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) {
- AlertDialog alertDialog = new AlertDialog.Builder(MainActivity.this).create();
- alertDialog.setTitle("Restart?");
- alertDialog.setMessage("Android needs to restart to update Emojis.");
- alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "I don't have a choice",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- try {
- Runtime.getRuntime().exec("su -c reboot");
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- });
- alertDialog.show();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement