I have an application which starts android service in separate process. By that mean two processes are running. One is my main application and another is service.
Now I tried to integrate crittercism (it's a Mobile Application Performance Management tool) in by below approaches but it is not able to generate crash log for service.
Integrate crittercism in app only.
Result : It generates crash log for app only, not for service.
Integrate crittercism in service in
onCreate()
method.Result : It is not showing crash log and also not showing app load in live stats.
Integrate crittercism in both app and service.
Result : It generates crash log for app only not for service.
So how do I get crash log for android service?
Here is the code by which I have implemented:
MainApplication.java
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
Crittercism.initialize(getApplicationContext(), "CRITTERCISM_APP_ID");
}
MyService.java
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
Crittercism.initialize(getApplicationContext(), "CRITTERCISM_APP_ID"); // Same app id which is used for MainApplication.java
}
build.gradle file of both service and main application:
dependencies {
compile 'com.crittercism:crittercism-android-agent:5.0.6'
}
Also added below permission for both service and main application
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>