A.I, Data and Software Engineering

Create a simple YET most addictive apps/games

C

With simple implementation, no user can escape from this addictive app! They will cry desperately for help! Let do it!

blank

The UI

Do not spend much time on this. As said, make it as simple as possible. You can use any text, images, for the activity.

An activity with only one image!

TRICK #01: Disable the back button

To let users stick to your app, the first trick is, of course, is… to block their escape button. We can achieve this by overriding the back button on an Android phone. We show the user to accept that they are not gonna leave this app by using the back button.

//Kotlin implementation
@Override
public fun onBackPressed() {
   Toast.makeText(this, "Sorry, you will stay in this app", Toast.LENGTH_LONG).show()
}

TRICK #02: Restart the app if forced close

How to change app color in Samsung S6/Android 5.0 recent apps

Well, to escape from the app, users have another option is to use the recent app or home buttons. The former lets users see the list of recently used apps and close them using swipe, while the latter will bring users to the home screen.

We want users to come back to our app by restarting the app right after being closed. To achieve that, we will override the onDestroy and onPause method and start the app with a thread.

//Kotlin implementation
override fun onPause() {
        restart()
        super.onPause()
    }
    override fun onDestroy() {
        restart()
        super.onDestroy()
    }
    fun restart() {
        Toast.makeText(this,"See you in 1 sec! :D", Toast.LENGTH_LONG).show()
        val intent = Intent(this, MainActivity::class.java)
        Handler().postDelayed(Runnable {
            startActivity(intent)
        }, 20)
    }

TRICK #03: START THE APP on Boot (depricated)

After Android 3.1, this method is no longer applied. Nevertheless, you can try if you want. Firstly, you need to add permission in your AndroidManifest.xml:

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

Also, in yourAndroidManifest.xml, define your service and listen for the BOOT_COMPLETED action:

<service android:name=".MyService" android:label="My Service">
    <intent-filter>
        <action android:name="com.petamind.MyService" />
    </intent-filter>
</service>
<receiver
    android:name=".receiver.StartMyServiceAtBootReceiver"
    android:label="StartMyServiceAtBootReceiver">
    <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED" />
    </intent-filter>
</receiver>

Then you need to define the receiver that will get the BOOT_COMPLETED action and start your service.

public class StartMyServiceAtBootReceiver extends BroadcastReceiver {
    @Override
    public fun onReceive(Context context, Intent intent) {
        if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
            val serviceIntent = Intent(context, MyService::class.java)
            context.startService(serviceIntent)
        }
    }
}

And now your service should be running when the phone starts up.

TRICK #04: notification flooding

By any chance they can get out of our app, make sure to send them notification constantly.

Video tutorial

The short video guides you how to create a simple yet most addictive apps/games.

Useful links

Add comment

A.I, Data and Software Engineering

PetaMinds focuses on developing the coolest topics in data science, A.I, and programming, and make them so digestible for everyone to learn and create amazing applications in a short time.

Categories