2012-11-02 67 views
1

我正在開發一個應用程序,我想從Google Play Store安裝應用程序後自動啓動應用程序。爲此搜索了一下,發現線程和答案表明這不能完成。 但我還在Play商店找到了一個應用程序,Auto Launch when Installed這非常有效。 任何人都可以告訴我這背後的邏輯。任何幫助都感激不盡。安裝時自動啓動應用程序

+1

它會在安裝後自動啓動其他應用程序而不是自己,對吧? –

+0

@SunnyKumarAditya是 –

+1

請參閱此鏈接。它可能有幫助。 http://stackoverflow.com/questions/1975521/autostart-android-application-after-installation-complete http://stackoverflow.com/questions/2127044/how-to-start-android -service-on-installation –

回答

2

您需要創建一個綁定到 BOOT_COMPLETED操作的BroadcastReceiver。

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.alfray.timeriffic" ...> 
    <application ...> 
     <receiver android:name=".MyBroadcastReceiver"> 
     <intent-filter> 
     <action android:name="android.intent.action.BOOT_COMPLETED" /> 
     </intent-filter> 
     </receiver> 
    </application> 

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

它可能工作。試試吧

+0

是的,但是這種方法工作的手機必須啓動一次正確的? –

+0

我認爲你是對的......我不確定。 –

+5

此方法僅適用於3.1之前的Android版本。現在,android需要應用程序在開始接收任何意圖之前至少啓動一次。 –

相關問題