1

So I've added the the BootStarterReceiver receiver in the manifest, I've added the OnBootCompletedListener implementation in the module file. (is this the correct practice btw? in the module class)

Now how do I start the application? what do I implement in the OnBootCompleted method?

There's the

cyborg.startActivity()

but I don't know how to use the Intent here as I don't have any activities, only controllers.

Alex Gold
  • 105
  • 8

1 Answers1

0

Firstly you need to add the BootStarterReceiver to the manifest:

<receiver
    android:name="com.nu.art.cyborg.common.utils.BootStarterReceiver">

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

Or just enable the BootStarterReceiver if you are using the latest(0.8.11 +) Cyborg version:

<receiver
    android:name="com.nu.art.cyborg.common.utils.BootStarterReceiver"
    android:enabled="true"/> 

You'd also need to add the respective permissions:

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

One this setup is done, choose your boot handling module and implement the OnBootCompletedListener, in the onBootCompleted method perform your code there.

As for staring a new activity at that point... I am not sure how your users will respond to that, but you can call cyborg.startActivity(), with an intent that will launch Cyborg's default ApplicationLauncher, and add the FLAG_ACTIVITY_NEW_TASK.

public void onBootCompleted() {
    Intent intent = new Intent(getApplicationContext(), ApplicationLauncher.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    cyborg.startActivity(intent);
}
TacB0sS
  • 10,106
  • 12
  • 75
  • 118