Uygulamamda, kullanıcının kendi giyilebilirliğinde kelimeler konuşmasını sağlayan bir özellik oluşturmaya çalışıyorum. Bu çalışır ve bir etkinlikteki verileri alırken çalışır. Sadece şimdi verileri bir hizmette almak istiyorum, ancak bu işe yaramıyor. Servis hiç başlatılmadı.Bildirim Eylem açılmıyor Servis
kod giyilebilir için bildirimde bulunmak:
public class LogisticWearableListener extends IntentService {
private String datum;
private String adres;
private LogisticAndroidApp app;
public LogisticWearableListener() {
super("LogisticWearableListener");
Log.d("called wearableserv", "called");
}
@Override
protected void onHandleIntent(Intent intent) {
Log.d("LogisticWearableService", "Service Received.");
app = (LogisticAndroidApp)getApplication();
Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
if (remoteInput != null) {
CharSequence seq = remoteInput.getCharSequence("PLACE");
datum = seq.toString();
adres = remoteInput.getCharSequence("ADDRESS").toString();
WearableOrder o = new WearableOrder();
o.setAdres(adres);
o.setPlace(datum);
app.getDataManager().saveWearableOrder(o);
//orders.add(o);
// initializeListView();
}
}
}
ve android tezahür beyanı:
String replyLabel = "Adres";
RemoteInput remoteInput = new RemoteInput.Builder("ADDRESS")
.setLabel(replyLabel)
.build();
RemoteInput remoteInput2 = new RemoteInput.Builder("PLACE")
.setLabel("Plaats van levering")
.build();
Intent replyIntent = new Intent(this, LogisticWearableListener.class);
PendingIntent replyPendingIntent =
PendingIntent.getService(this, 0, replyIntent,
PendingIntent.FLAG_CANCEL_CURRENT);
NotificationCompat.Action action =
new NotificationCompat.Action.Builder(R.drawable.lzicon,
getString(R.string.wearable_input_start), replyPendingIntent)
.addRemoteInput(remoteInput)
.addRemoteInput(remoteInput2)
.build();
Notification notification =
new NotificationCompat.Builder(logisticLoginInfoScreen)
.setSmallIcon(R.drawable.lzicon)
.setContentIntent(replyPendingIntent)
.setContentTitle("Order invoeren")
.extend(new NotificationCompat.WearableExtender().addAction(action))
.build();
NotificationManagerCompat notificationManager =
NotificationManagerCompat.from(logisticLoginInfoScreen);
notificationManager.notify(55, notification);
Bu Servis kodudur
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.afc.mobile365.Test4Sure"
android:versionCode="222"
android:versionName="3.8.71">
<uses-sdk
android:maxSdkVersion="23"
android:minSdkVersion="14"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"></supports-screens>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:name=".LogisticAndroidApp"
android:icon="@drawable/lzicon"
android:label="@string/app_name"
android:largeHeap="true"
tools:replace="android:icon">
<activity
android:name=".SplashActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/Theme.Transparent"
android:windowSoftInputMode="stateHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".LogisticActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/Theme.Logistic"
android:windowSoftInputMode="stateHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".LogisticLoginInfoScreen"
android:launchMode="singleInstance"
android:screenOrientation="portrait"
android:theme="@style/Theme.Logistic"
android:windowSoftInputMode="stateHidden"></activity>
<activity
android:name=".StartWorkDayActivity"
android:noHistory="true"
android:screenOrientation="portrait"
android:theme="@style/Theme.Logistic"
android:windowSoftInputMode="stateHidden"></activity>
<activity
android:name=".PlanningOrdersActivity"
android:noHistory="true"
android:screenOrientation="portrait"
android:theme="@style/Theme.Logistic"
android:windowSoftInputMode="stateHidden"></activity>
<activity
android:name=".StopWorkDayActivity"
android:noHistory="true"
android:screenOrientation="portrait"
android:theme="@style/Theme.Logistic"
android:windowSoftInputMode="stateHidden"></activity>
<activity
android:name=".StartWorkDayInfoActivity"
android:noHistory="false"
android:screenOrientation="portrait"
android:theme="@style/Theme.Logistic"
android:windowSoftInputMode="stateHidden"></activity>
<activity
android:name=".DeliveryListActivity"
android:noHistory="false"
android:screenOrientation="portrait"
android:theme="@style/Theme.Logistic"
android:windowSoftInputMode="stateHidden"></activity>
<activity
android:name=".DeliveryDetailActivity"
android:screenOrientation="unspecified"
android:theme="@style/Theme.Logistic"
android:windowSoftInputMode="stateHidden"></activity>
<activity
android:name=".LogisticInfoActivity"
android:noHistory="true"
android:screenOrientation="portrait"
android:theme="@style/Theme.Logistic"
android:windowSoftInputMode="stateHidden"></activity>
<activity
android:name=".WisselActivity"
android:noHistory="true"
android:screenOrientation="portrait"
android:theme="@style/Theme.Logistic"
android:windowSoftInputMode="stateHidden"></activity>
<activity
android:name=".CustomerSigningActivity"
android:noHistory="false"
android:screenOrientation="portrait"
android:theme="@style/Theme.Logistic"
android:windowSoftInputMode="stateHidden"></activity>
<activity
android:name=".LogisticScanTagsActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.Logistic"
android:windowSoftInputMode="stateHidden">
<!-- android:noHistory="true" -->
</activity>
<activity
android:name=".PauzeActivity"
android:noHistory="true"
android:screenOrientation="portrait"
android:theme="@style/Theme.Logistic"
android:windowSoftInputMode="stateHidden"></activity>
<activity
android:name=".StopPauzeActivity"
android:noHistory="true"
android:screenOrientation="portrait"
android:theme="@style/Theme.Logistic"
android:windowSoftInputMode="stateHidden"></activity>
<activity
android:name=".CameraActivity"
android:noHistory="true"
android:screenOrientation="landscape"
android:theme="@style/Theme.Logistic"
android:windowSoftInputMode="stateHidden"></activity>
<service android:name="com.teamviewer.sdk.screensharing.api.TVSessionService" />
<service
android:name=".LogisticDBManagerService"
android:icon="@drawable/appicon"
android:label="@string/service_name"
android:process=":logistic_background" />
<service
android:name=".LogisticDBGpsLocatieService"
android:icon="@drawable/appicon"
android:label="locationService" />
<receiver
android:name=".LogisticServiceStartupReceiver"
android:process=":logistic_background">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<receiver
android:name=".AlarmReceiver"
android:process=":logistic_background" />
<receiver
android:name=".ATimeReceiver"
android:process=":logistic_background2" />
<receiver android:name=".FotoUploadAlarmReceiver" />
<receiver android:name=".LocationChangedReceiver">
<intent-filter>
<action android:name="logistic.android.app.gps"></action>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<activity
android:name=".NavigationActivity"
android:label="@string/title_activity_navigation"></activity>
<activity
android:name=".CacheFotosActivity"
android:label="@string/title_activity_cache_fotos"
android:noHistory="true"
android:screenOrientation="portrait"
android:theme="@style/Theme.Logistic"></activity>
<activity
android:name=".OrderRegelActivity"
android:label="@string/title_activity_bon"
android:noHistory="true"
android:screenOrientation="landscape"
android:theme="@style/Theme.Logistic"></activity>
<activity
android:name=".OrderRegelOverviewActivity"
android:label="@string/title_activity_order_regel_overview"
android:noHistory="true"
android:screenOrientation="landscape"
android:theme="@style/Theme.Logistic"></activity>
<activity
android:name=".OrderRegelCheckboxActivity"
android:label="@string/title_activity_order_regel_checkbox"></activity>
<activity
android:name=".EmballageActivity"
android:label="@string/title_activity_emballage"
android:noHistory="true"
android:theme="@style/Theme.Logistic"></activity>
<activity
android:name=".DialogActivity"
android:label="@string/title_activity_dialog"
android:screenOrientation="portrait"
android:theme="@style/Theme.Logistic"></activity>
<activity
android:name=".ScanTestActivity"
android:label="@string/title_activity_scan_test"
android:theme="@style/Theme.Logistic"></activity>
<activity
android:name=".LogisticScanEmbaActivity"
android:label="@string/title_activity_logistic_scan_emba"
android:screenOrientation="portrait"
android:theme="@style/Theme.Logistic"></activity>
<activity
android:name=".TankRegistratieActivity"
android:label="@string/title_activity_tank_registratie"
android:screenOrientation="portrait"
android:theme="@style/Theme.Logistic"></activity>
<activity
android:name=".LaadLijstEmballageActivity"
android:label="@string/title_activity_laad_lijst_emballage"
android:screenOrientation="portrait"
android:theme="@style/Theme.Logistic"></activity>
<activity
android:name=".TestScanActivity"
android:label="@string/title_activity_test_scan"></activity>
<!-- Register Service -->
<activity
android:name=".LaadLijstOntvangEmballageActivity"
android:label="@string/title_activity_laad_lijst_ontvang_emballage"
android:screenOrientation="portrait"
android:theme="@style/Theme.Logistic"></activity>
<!--
ATTENTION: This was auto-generated to add Google Play services to your project for
App Indexing. See https://g.co/AppIndexing/AndroidStudio for more information.
-->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity android:name=".Wearable.WearableActivity" android:label="Plaats Order"
android:screenOrientation="portrait"
android:theme="@style/Theme.Logistic"></activity>
</application>
<service android:name=".LogisticWearableListener" android:exported="true">
</service>
Çalışmıyor gibi görünüyorsunuz, ancak giriş için teşekkürler. – Kezufru
Logcat'ta herhangi bir hata var mı? Logcat'ı filtrelemeyin, aksi halde önemli bir şeyi kaçırabilirsiniz. Hizmetiniz başladı mı? Herhangi bir kayıt eklediniz mi? –
Hayır, hiçbir şey göstermiyor. Uygulamada çalıştığım diğer servislerin günlüklerini görüyorum, bu yüzden asla çağrılmadığını düşünüyorum. – Kezufru