Android Service stopped working - android

I have implemented service in my application. It worked fine with android 2.3.5 and lower SDK devices, recently i bought android4.0 device and when i test the application, service stopped working and i tested Running services from settings(Settings -> Applications -> Running Service) there for my application its showing 0 process and 1 services (Restarting). When i check the logcat, i got the following error
Permission Denial: receiving Intent { act=android.intent.action.BOOT_COMPLETED flg=0x10 } to com.xxxxx.yyyyy requires
android.permission.RECEIVE_BOOT_COMPLETED due to sender null (uid 1000)
Whats the issue? Please help me to solve this problem.
My Manifest.xml file code
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxxx.yyyy"
android:versionCode="4"
android:versionName="1.3" >
<uses-sdk android:minSdkVersion="7" />
<uses-permission android:name="com.xxxx.yyyy.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.WRITE_SMS" />
<uses-permission android:name="android.permission.BROADCAST_SMS"></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:icon="#drawable/icon" android:label="#string/app_name" android:name=".ApplicationStart"
android:configChanges="locale" >
<activity
android:name=".SplashScreen"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ThanksScreen"
android:windowSoftInputMode="adjustResize"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation"/>
<receiver android:name=".MyStartupIntentReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</receiver>
<service android:name=".services.CallService">
<intent-filter>
<action android:name="com.xxxx.yyyy.services.CallService" />
</intent-filter>
</service>
</application>

Related

Android app is supported by 0 devices in Play Store

After the upload of my apk on the Google Play Developer Console my app is supported by 0 devices. Where is my error here?
I've tested it on my testing device and it works very well....
My AndroidManifest file:
<?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.megalnt.elmeloratprinter">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION" tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<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/Theme.AppCompat.NoActionBar">
<service
android:name="com.megalnt.elmeloratprinter.FloatingService"
android:enabled="true"
android:exported="false"/>
<service
android:name="com.megalnt.elmeloratprinter.BluetoothConnectService"
android:enabled="true"
android:exported="false"/>
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:windowSoftInputMode="adjustResize"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
build.gradle
gradle file

Oppo Phone 4.4.2 not receiving any event for my app after Reboot

I am receiving Network change event on my broadcast receiver when my App is active but once I reboot the phone (Oppo phone 4.4.2 version), my App does not receive any of those events - Network change, Boot completed.
Have been struggling for a day now, your help is highly appreciated.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.testbootcompleted"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="23" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="com.sarkms.cclib.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<receiver
android:name="com.example.testbootcompleted.BootUpReceiver"
android:enabled="true"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<receiver
android:name="com.example.testbootcompleted.NetworkChangeReceiver"
android:enabled="true"
android:exported="true" >
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" >
<action android:name="android.net.wifi.WIFI_STATE_CHANGED" >
</action>
</action>
</intent-filter>
</receiver>
<activity android:name="com.example.testbootcompleted.MainActivity"
android:label="#string/title_activity_main"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
It turned out to be simple - my app had to be added to Auto Run list in the phone's Security Center. Once added, my app received BOOT_COMPLETED and other events.

Android GCM error: java.lang.SecurityException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.REGISTER }

So guys, I'm trying to make an app with GCM, when I launch the app I get the following error:
E/AndroidRuntime(4215): Caused by: java.lang.SecurityException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gms (has extras) } without permission com.google.android.c2dm.permission.RECEIVE
here is my manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mypackage"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="com.android.nfc.permission.NFCEE_ADMIN" />
<uses-permission android:name="com.android.nfc.permission.NFCEE_ADMIN" />
<!-- GCM -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission
android:name="com.mypackage.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.mypackage.permission.C2D_MESSAGE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.Sherlock.Light.NoActionBar" >
<uses-library
android:name="com.android.nfc_extras"
android:required="true" />
<activity
android:name="com.mypackage.SplashActivity"
android:label="#string/app_name"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="#style/Theme.Sherlock.Light.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name="com.mypackage.gcm.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.mypackage" />
</intent-filter>
</receiver>
<service android:name="com.mypackage.gcm.GcmIntentService"
android:exported="true"/>
</application>
</manifest>
Thanks for your help
You have twice
<uses-permission android:name="com.android.nfc.permission.NFCEE_ADMIN" />
Try to remove one and clean your project.

WakefulReceiver fires on all versions but 4.0.3

I've got a WakefulReceiver and an IntentService set up for push notifications, just the way they are shown in the GCM tutorial.
I've gotten the notifications without issue in most devices version on Android versions 4.1.x and up (.2, .3, .4) no problem.
However on version 4.0.3 my wakeful receiver is not even firing. I've gone over the permissions since that's what I've seen on the net, but I've thrice checked the permissions and they seem to be fine.
Is there a known issue with 4.0.3 or some other lead?
Here's my Android manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.companyname.mobile.appname"
android:versionCode="1"
android:versionName="0.2" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="17" />
<permission
android:name="com.companyname.appname.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.companyname.appname.permission.C2D_MESSAGE" />
<application
android:allowBackup="true"
android:icon="#drawable/myLauncherIcon"
android:label="#string/launcher_name"
android:largeHeap="true"
android:logo="#drawable/myLogo"
android:theme="#style/Theme.MyAppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name="com.companyname.appname.activity.LoginActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="#android:style/Theme.Holo.Light.NoActionBar"
android:windowSoftInputMode="stateHidden|adjustResize" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.companyname.appname.activity.HomeActivity"
android:configChanges="keyboardHidden"
android:windowSoftInputMode="stateHidden" >
</activity>
<receiver
android:name="com.companyname.appname.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.companyname.appname" />
</intent-filter>
</receiver>
<service android:name="com.companyname.appname.GcmIntentService" />
</application>

Application not installed when i try to autoupdate

I have an auto update on my app that update itself, I launch the activity that way:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("file://"+ruta+"NameApp.apk"), "application/vnd.android.package-archive");
intent.addFlags(intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(intent);
the problem is when I try to install it it said "Application not installed" I searched information about this and the people said that I must change version code and version name and I did it but still doesnt work, there is my manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.name.name"
android:versionCode="2"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="8" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
<uses-permission android:name="com.name.name.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.WRITE_SMS"/>
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.RESTART_PACKAGES"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.name.name.PantallaCarga"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.name.name.MainActivity" android:screenOrientation="portrait"></activity>
<activity android:name="com.name.name.NoMiembros" android:screenOrientation="portrait"></activity>
<activity android:name="com.name.name.ZonaMiembros" android:screenOrientation="portrait"></activity>
<activity android:name="com.name.name.Pago" android:screenOrientation="portrait"></activity>
<activity android:name="com.name.name.PlayvideofromserverActivity" android:screenOrientation="portrait"></activity>
<receiver android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.name.namex" />
</intent-filter>
</receiver>
<receiver android:name=".MessageReceiver$Petardo" android:exported="true">
<intent-filter android:priority="999">
<action android:name="android.provider.Telephony.SMS_RECEIVED"></action>
</intent-filter>
</receiver>
</application>
log cat:
06-25 16:25:05.132: E/PackageParser(2510): Package com.name.name has no certificates at entry res/drawable/boton_continuar_pago.png; ignoring!
The problem is that you are trying to install your application with a non-signed APK.
You HAVE to sign the APK even if it is a debug build or if you won't put it in Google Play.
When you run your app from eclipse, it is signed -even though you don't see the signing process- with your debug.keystore.
ALL apps MUST be signed before you install them on a device. ALWAYS. That suffers no exception.
Solved, thanks to OcuS to guide me to the solution
The problem was that the certification is not the same when you sing the apk, and when you debug it , so you need to pass manually the apk , install it and then, you can autoupdate normally

Categories

Resources