λ³Έλ¬Έ λ°”λ‘œκ°€κΈ°
πŸ‘¨πŸΌ‍πŸ’»κ°œλ°œ/μ•ˆλ“œλ‘œμ΄λ“œ μŠ€νŠœλ””μ˜€

μ•ˆλ“œλ‘œμ΄λ“œ μŠ€νŠœλ””μ˜€ - λΆ€νŒ…μ‹œ μžλ™ μ‹€ν–‰

by Janger 2021. 12. 19.
728x90
λ°˜μ‘ν˜•

[AndroidManifest.xml]

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />


<receiver android:name=".StartActivityOnBootReceiver">
    <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED" />
        <action android:name="android.intent.action.QUICKBOOT_POWERON" />
    </intent-filter>
</receiver>

 

[StartActivityOnBootReceiver.java]

package com.codinginflow.onbootreceiverexample;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;


public class StartActivityOnBootReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
            Intent i = new Intent(context, MainActivity.class);
            i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(i);
        }
    }
}

 

 

μ°Έμ‘°: 

https://gist.github.com/codinginflow/7878602cfc5afde16d90f2d8d611c8a0

 

Start App on Boot Tutorial

Start App on Boot Tutorial. GitHub Gist: instantly share code, notes, and snippets.

gist.github.com

https://www.youtube.com/watch?v=4_CkU9L2mCo&ab_channel=CodinginFlow 

https://stackoverflow.com/questions/1056570/how-to-auto-start-an-android-application

 

How to Auto-start an Android Application?

I'm not sure how to autostart an android application after the android emulator completes its booting. Does anyone have any code snippets that will help me?

stackoverflow.com

 

728x90
λ°˜μ‘ν˜•