I am trying to open an activity and a service together. I am using Android Studio 2.3.3. I have created an empty activity for the Phone and Tablet, API 14. I was able to open the activity which popped up the activity Hello World. I created another empty activity and it contains a print service. I am able to open the activity and service separately. When I add the service to the activity, the activity open but the service does not. Here is the manifest file for the activity:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.testactivity">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Here is the manifest for the service:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.testprintservice">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<service
android:name="com.example.android.testprintservice.TestPrintService"
android:permission="android.permission.BIND_PRINT_SERVICE">
<intent-filter>
<action android:name="android.printservice.PrintService"/>
</intent-filter>
<meta-data
android:name="android.printservice"
android:resource="@xml/test_printservice">
</meta-data>
</service>
</application>
</manifest>