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>
Related
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.
I am making an application, when I run that application I am getting following error during running.
[2015-06-19 17:11:06 - Ecommerce] Installation error:
[2015-06-19 17:11:06 - Ecommerce] Please check logcat output for more details.
[2015-06-19 17:11:06 - Ecommerce] Launch canceled!
I don't know where I am doing wrong, I saw so many solutions but that does not match to my problem. Here is my Manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ecommerce.app"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission
android:name="com.ecommerce.app.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission
android:name="com.ecommerce.app.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<receiver
android:name="com.ecommerce.app.utils.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.ecommerce.app" />
</intent-filter>
</receiver>
<service android:name="com.ecommerce.app.utils.GCMIntentService" />
<activity
android:name="com.ecommerce.app.SplashscreenActivity"
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.ecommerce.app.MainActivity" />
<activity android:name="com.ecommerce.app.ShoppingCartActivity" />
<activity android:name="com.ecommerce.app.AuthenticateActivity" />
<activity android:name="com.ecommerce.app.BranchLocationActivity" />
<activity android:name="com.ecommerce.app.ProfileActivity" />
<activity android:name="com.ecommerce.app.VoucherActivity" />
<activity android:name="com.ecommerce.app.EShopFragmentActivity" />
<activity android:name="com.ecommerce.app.EShopDetailActivity" />
<activity android:name="com.ecommerce.app.PaypalActivity" />
<activity android:name="com.ecommerce.app.FeedbackActivity" />
<activity android:name="com.ecommerce.app.LoyaltyActivity" />
<activity android:name="com.ecommerce.app.VoucherDisplayActivity" />
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<receiver
android:name="com.ecommerce.app.utils.GcmBroadcastReceiver"
android:process=":remote" >
</receiver>
<meta-data android:name="com.google.android.gms.version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="#string/map_key" />
</application>
</manifest>
Try specifying google play services version in meta-data
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
From google maps doc-https://developers.google.com/maps/documentation/android/start
Edit your application's AndroidManifest.xml file, and add the
following declaration within the element. This embeds
the version of Google Play services that the app was compiled with.
I'm trying to create multiple versions of my app for different clients, and have done these steps:
-Duplicate all the folders with a simple copy and paste in the finder,
-Open the project i have just created,
-Changed the package name in the AndroidManifest.xml,
-Refactor all the classes and files that where failing (with the refactor option),
-Clear project and run.
I have been able to instal the 2 apps in the device, but every time I try to run any app the os shows me this:
As you can see I have the 2 app installed and running:
And every time i press a button ask me again:
This is the first AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="epinom.jm.smarthotel"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="16" />
<permission android:name="epinom.jm.smarthotel.maps.googlev2.permission.MAPS_RECEIVE"
android:protectionLevel="signature">
</permission>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="epinom.jm.smarthotel.maps.googlev2.permission.MAPS_RECEIVE"/>
<uses-feature android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/MyTheme" >
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyBjg8TtFgJTMuLFyiGlScVuEDNPjJnLxyM"/>
<activity
android:name=".SplashActivity"
android:label="#string/title_activity_home"
android:screenOrientation="portrait"
android:launchMode="singleTask" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".vcMainScreen"
android:label="#string/title_activity_home"
android:screenOrientation="portrait"
android:launchMode="singleTask" >
<intent-filter>
<action android:name="vcMainScreen" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
This is the second AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="goSmart.guestperience.MoncloaDeSanLazaro"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="16" />
<permission android:name="goSmart.guestperience.MoncloaDeSanLazaro.maps.googlev2.permission.MAPS_RECEIVE"
android:protectionLevel="signature">
</permission>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="goSmart.guestperience.MoncloaDeSanLazaro.maps.googlev2.permission.MAPS_RECEIVE"/>
<uses-feature android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/MyTheme" >
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyDNqe1PO7pvZLtba_Vu3m5BvmOdJtqhU0M"/>
<activity
android:name=".SplashActivity"
android:label="#string/title_activity_home"
android:screenOrientation="portrait"
android:launchMode="standard" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".vcMainScreen"
android:label="#string/title_activity_home"
android:screenOrientation="portrait"
android:launchMode="standard" >
<intent-filter>
<action android:name="vcMainScreen" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
I'm starting with Android development so please tell me what I'm doing wrong, is there something that I'm missing to configure.
I'm using Eclipse on a Mac.
TO ANWSER THE QUESTION OF #David, this is the code i use to call every new screen:
String IntentName = Util.getController(buttons
.getJSONObject(arg2)
.getString("ViewController"));
Intent intento = new Intent(IntentName);
intento.putExtra(
"jsonConfig",
buttons.getJSONObject(arg2).getString(
"JsonConfigFile"));
intento.putExtra("title", buttons.getJSONObject(arg2)
.getString("Label"));
intento.putExtra("icon", buttons.getJSONObject(arg2)
.getString("ImageIconTitle"));
startActivity(intento);
You have 2 activities with the same name.... in differents AppĀ“s.
Change the name of 1 activity.
Thanks to the comment of Nimish Choudhary and more Google the answer to my problem was that I have to make unique all Activity names for to the 2 Apps.
So in the AndroidManifest.xml I have change all the names of all the Activities, i.e.:
<activity
android:name="app1.vcMainScreen"
android:label="#string/title_activity_home"
android:screenOrientation="portrait"
android:launchMode="standard" >
<intent-filter>
<action android:name="app1.vcMainScreen" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
And I change the return of the switch when I was calling the function:
Util.getController(buttons
.getJSONObject(arg2)
.getString("ViewController")
Now the return is:
switch (Integer.parseInt(num)) {
case 0:
return "app1.vcMainScreen";
default:
return null;
}
I hope this help someone one day.
Thanks to all.
GCM server side is working fine. GCM Client side is working fine for emulator but not for device.
GCM SERVICE IS WORKING FINE FOR EMULATOR.
Below is my manifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.spidertechnologiesllp.yay"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="18" />
<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" />
<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- Creates a custom permission so only this app can receive its messages. -->
<permission
android:name="com.spidertechnologiesllp.yay.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.spidertechnologiesllp.yay.permission.C2D_MESSAGE" />
<!-- This app has permission to register and receive data message. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- Permission to vibrate -->
<uses-permission android:name="android.permission.VIBRATE" />
<application
android:allowBackup="true"
android:icon="#drawable/yayicon"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.spidertechnologiesllp.yay.YayTabActivity"
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>
<receiver
android:name=".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.spidertechnologiesllp.yay" />
</intent-filter>
</receiver>
<service
android:name=".GCMNotificationIntentService"/>
<activity
android:name="com.spidertechnologiesllp.yay.YayPredictionActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.spidertechnologiesllp.yay.YayOptionsActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.spidertechnologiesllp.yay.YayLoginActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
</activity>
<activity android:name="com.facebook.LoginActivity" >
</activity>
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/app_id" />
</application>
</manifest>
STRUGGLING SINCE 2 DAYS.
ANY HELP WOULD BE APPRECIATED !!!
Youdint not place permission in com.spidertechnologiesllp.permission is missing
Replace this in manifest file
<permission
android:name="com.spidertechnologiesllp.yay.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
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>