My problem is that i need that my app is always awake to receive notification because i want to create a chat app like whatsapp, but when the app is closed the notifications do not work, i have read http://developer.android.com/intl/es/guide/components/services.html and http://developer.android.com/intl/es/guide/components/processes-and-threads.html and i thought that if i created other process with android:process attribute on GcmListenerService i could keeping alive the service but that did not work
the other way that i thought was overriding the onStartCommand method from GcmListenerService and to return START_STICKY constant
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
return START_STICKY;
}
but the problem with this way is that GcmListenerService has the onStartCommand method with final so i can not override that method
so on android documentation there is not solution to this problem?
the only one solution that i could find is to go to setting on my cellphone and after that go to power saving ----> protected applications and to check my app to keep my app working even when my app were closed
so anyone has the solution for this problem? thanks
Edit #2
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="schan.main"
>
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="17"/>
<permission android:name="schan.main.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="schan.main.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.Schan" >
<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>
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="schan.main" />
</intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
</receiver>
<service
android:name="schan.main.MyGcmListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</service>
<service
android:name="schan.main.MyInstanceIDListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID" />
</intent-filter>
</service>
<service
android:name="schan.main.RegistrationIntentService"
android:exported="false">
</service>
<activity
android:name=".LoginActivity"
android:icon="@mipmap/ic_launcher"
android:label="@string/login"
android:parentActivityName=".MainActivity"
android:theme="@style/Theme.Schan" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="schan.main.MainActivity" />
</activity>
<activity
android:name=".SigupActivity"
android:label="@string/joinus"
android:parentActivityName=".MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="schan.main.MainActivity" />
</activity>
<activity
android:name=".Alert"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:label="@string/title_activity_alert_dialog" >
</activity>
</application>
</manifest>
UPDATE
i found my real problem, is this one how can i put this configuration on my huawei cellphone?