hamid_hr
چهارشنبه 30 بهمن 1392, 13:18 عصر
سلام
من یه سرویس نوشتم که قراره زمانی که سیستم عامل بوت میشه اجرا بشه
این سرویس روی گوشی با اندروید 2.3 کار میکنه ولی وقتی میریزمش روی تبلت با اندروید 4.0.4 به صورت خودکار اجرا نمیشه
این کد منه
public class BroadCastStart extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
Log.i("MessegSend", "------------------ Auto Start --------------------");
Intent intentq = new Intent(context,PSAryaServiceActivity.class);
context.startService(intentq);
}
}
ابتم AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="MP.PSArya.Service"
android:versionCode="1"
android:versionName="1.0"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<receiver
android:name=".BroadCastStart"
android:exported="true">
<intent-filter android:priority="1000">
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<service android:enabled="true" android:name=".PSAryaServiceActivity" />
</application>
</manifest>
من یه سرویس نوشتم که قراره زمانی که سیستم عامل بوت میشه اجرا بشه
این سرویس روی گوشی با اندروید 2.3 کار میکنه ولی وقتی میریزمش روی تبلت با اندروید 4.0.4 به صورت خودکار اجرا نمیشه
این کد منه
public class BroadCastStart extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
Log.i("MessegSend", "------------------ Auto Start --------------------");
Intent intentq = new Intent(context,PSAryaServiceActivity.class);
context.startService(intentq);
}
}
ابتم AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="MP.PSArya.Service"
android:versionCode="1"
android:versionName="1.0"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<receiver
android:name=".BroadCastStart"
android:exported="true">
<intent-filter android:priority="1000">
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<service android:enabled="true" android:name=".PSAryaServiceActivity" />
</application>
</manifest>