I'm attempting to add the rtsp server portion of libstreaming to my application and run it as a service, but even though my application builds and runs fine, the service part isn't being installed and I would appreciate any help figuring out why. I think I'm missing a step.
I added libstreaming to my existing application as a module, and libstreaming is listed as a dependency. It all compiles and starts fine, but context.startService() returns null for a ComponentName. According to the docs, this means the service "does not exist", so I think I'm missing something, but I don't know what. I'm building in Android Studio, then using shift+F9 to install my app and start debugging, this must install the application but not the service part? Any help would be greatly appreciated!
Here's how I'm configured:
Dependency:
My code to start the service:
ComponentName cName = null;
try
{
// Start the RTSP server. Returns name of the component that is started, or is already running
cName = this.startService(new Intent(this, RtspServer.class));
}
catch(Exception e)
{
postUIMessage("onCreate() startService() exception: " + e.toString());
}
if(cName != null)
{
postUIMessage("Service started: " + cName.toString());
}
else
{
postUIMessage("Service NOT started: " + cName.toString());
}
My AndroidManifest.xml file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.matt.mattvideoreceiver" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO"></uses-permission>
<uses-permission android:name="android.permission.CAMERA"></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS"></uses-permission>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<service android:name="net.majorkernelpanic.streaming.rtsp.RtspServer"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>