0

I wrote a code in android about bluetooth programming.I want that when I opened the tablet The app start firstly.The tablet must be specific to an application.

How is it possible ?

Shobhit Puri
  • 25,769
  • 11
  • 95
  • 124
user3041263
  • 53
  • 1
  • 1
  • 8

3 Answers3

0

If you want to start your app as soon as the user starts the tablet, then user atleast should've opened the application once after installation. Then you can use android.intent.action.BOOT_COMPLETED action and register a BroadcastReceiver to start the application automatically everytime the user reboots the deive. See Auto start application after boot completed in Android and Broadcast receiver not working in ICS if the app is not started atleast once. Hope this helps.

Community
  • 1
  • 1
Shobhit Puri
  • 25,769
  • 11
  • 95
  • 124
0

Creating a home screen/launcher app is the way to go.

<activity android:name="Home"
            ...
            android:launchMode="singleInstance"
            android:stateNotNeeded="true">
    <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.HOME"/>
            <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
</activity>

category android:name="android.intent.category.HOME" - makes your application a home screen(launcher) app. You can view the home screen sample from android-sdk samples/Home

nikvs
  • 1,090
  • 5
  • 9
0

You can add in Manifest file

<intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.MONKEY" />
        <category android:name="android.intent.category.HOME" />
      </intent-filter>

to the main Activity declaration. Then you should set your app to always run as default

Gooziec
  • 2,736
  • 1
  • 13
  • 18