I want to be able to "persist" my tooleap activity, so that when user click on mini app Icon, my activity doesn't have to be reloaded every time.
This behaviour is implemented in Tooleap Search activity, when I reopened search activity from anywhere, search activity is immediately shown (no loading indicator).
I already launch my tooleap activity as persistent, here's my code to launch the mini app
TooleapPersistentMiniApp miniApp = new TooleapPersistentMiniApp(this, TooleapTestActivity.class);
miniApp.allowUserToDismiss(true);
miniApp.contentTitle = getResources().getString(R.string.app_name);
miniApp.contentText = getResources().getString(R.string.app_name);
miniApp.bubbleBackgroundColor = 0xFF03A9F4;
miniApp.notificationText = getResources().getString(R.string.tooleap_start_notif);
miniApp.when = new Date();
Tooleap.getInstance(this).addMiniApp(miniApp);
Here's my AndroidManifest which is directly associated with tooleap
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp.package"
android:installLocation="internalOnly" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<activity android:name=".TooleapTestActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:launchMode="singleInstance"
android:taskAffinity=".tooleap">
<intent-filter>
<action android:name="com.tooleap.sdk.TOOLEAP_SHOW"/>
</intent-filter>
</activity>
<service android:name="com.tooleap.sdk.TooleapAppService"/>
<service android:name="com.tooleap.sdk.TooleapUIService"
android:process=":UIService"
android:exported="true">
<intent-filter>
<action android:name="com.tooleap.sdk.BIND_UI_SERVICE" />
</intent-filter>
</service>
<receiver android:name="com.tooleap.sdk.TooleapReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REPLACED"/>
<data android:scheme="package"/>
</intent-filter>
<intent-filter>
<action android:name="com.tooleap.sdk.TOOLEAP_ACTION"/>
</intent-filter>
</receiver>
</manifest>
Here's the flow detail:
What am I doing wrong here? I can't seem to have same behavior as Tooleap Search Activity persistency.
I'm one of the developers of the Tooleap SDK.
Short answer: Your mini app will always have a spinner (loading indicator) inside the side screen whenever you press on the floating bubble.
Long answer:
The spinner is just for show.
The first time you press on the floating bubble your activity is created (onCreate
is called). After that, whenever you open / close the floating side screen, onResume
/ onPause
are called.
Your activity is resumed just like any normal activity (no reload or something like that). The activity resume may take a few hundred milliseconds (depending on the logic inside the activity onResume method). During that time the spinner is shown.
Note: If you feel that you always see the spinner for a long period of time, check that your activity doesn't get destroyed (onDestroy
) every time you close the side screen. One reason for that might be explicitly calling finish()
inside the activity code. If onDestroy
is called, the next time you press on the floating bubble onCreate
will be called again, and it it may take longer for your app to appear.
Regarding the search mini app, it is a special floating window, and not a regular activity. As it is part of the Tooleap SDK, it can be shown without the spinner.