Piszę 1 aplikację dla systemu Android 4.0 i jest ona uruchamiana za pośrednictwem nadawcy-odbiornika. Moje kodu jest poniżej:Nie można odbierać transmisji w ICS
W AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<receiver android:name="com.Android.Exercise.StartUpReceiver"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<!--<action android:name="StartInstrument" />
<action android:name="PrintControlName" /> -->
</intent-filter>
</receiver>
<service android:enabled="true" android:name="StartAUT_Service">
<intent-filter>
<action android:name="com.Android.Exercise.StartAUT_Service" />
</intent-filter>
</service>
</application>
W klasie StartUpReceiver:
public class StartUpReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
Log.i("Broadcast", "onReceive");
Intent i = null;
if(intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)){
i = new Intent(context, StartAUT_Service.class);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
context.startService(i);
}
}
Po ponownym uruchomieniu mojego urządzenia, nie mogę odbierać broardcast. Proszę mi pomóc, dziękuję tyle
Po dodaniu tagu, nadal nie mogę odbierać polecenia rozgłaszania. W systemie Android 2.2 jest ok, ale Android 4.0, nadal nie działa. – user1266236
Ponownie uruchomiłem moje urządzenie, ale nadal nie działa moje broadcast.hix | T_T | – user1266236
Usunąłeś ten tag uprawnień w ramach działania? –