Bonjour à tous, je souhaiterais dans un simple service afficher un petit message lors de la mise en root de mon téléphone.

Pour cela j'ai créé un service :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
public class MySimpleService extends Service{
 
	@Override
	public IBinder onBind(Intent arg0) {
		// TODO Auto-generated method stub
		return null;
	}
 
	@Override
	public void onCreate() {
		super.onCreate();
 
		Toast.makeText(this, "Service Created", Toast.LENGTH_LONG).show();
 
	}
 
	@Override
	public void onDestroy() {
		super.onDestroy();
 
		Toast.makeText(this, "Service Destroyed", Toast.LENGTH_LONG).show();
 
	}
 
	@Override
	public int onStartCommand(Intent intent,int flags, int startId) {
 
		Toast.makeText(this, "Service Started", Toast.LENGTH_LONG).show();
		return super.onStartCommand(intent, flags, startId);
 
 
 
	}
 
}
Une Classe pour le boot :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
public class MyStartupIntentReceive extends BroadcastReceiver{
 
	@Override
	public void onReceive(Context arg0, Intent arg1) {
		// TODO Auto-generated method stub
 
		Intent serviceIntent = new Intent();
		serviceIntent.setAction("com.wissen.startatboot.MyService");
		arg0.startService(serviceIntent);
 
	}
 
}
Mon fichier manifest :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
 
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
 
        <receiver android:name="MyStartupIntentReceive">
			<intent-filter>
			<action
			android:name="android.intent.action.BOOT_COMPLETED" />
			<category android:name="android.intent.category.HOME" />
			</intent-filter>
		</receiver>
 
        <service android:name="MySimpleService" android:exported="false">
			<intent-filter>
			<action
			android:name="com.example.mysimpleservice.MySimpleService" />
			</intent-filter>
		</service>
 
    </application>
Mais lorsque je boot mon téléphone, rien ne s'affiche est-ce normal?

Merci d'avance