I'm developing an iOS and android app using ionic/cordova, and I'm trying to get the push notifications working on both platforms with the PushPlugin library.
The thing is I'm getting the push notifications working OK for iOS, but in android is a little weird what is going on, when the app is in foreground, the notification arrives successfully, but when the app is in background (the app is close), the notification never arrives...
Any thoughts about this? Permissions?
I followed this tutorial for getting the gcm notifications working (my code is similar) and also I'm testing the notifications with genymotion.
Here's my AndroidManifest.xml
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="com.CohereHealth.CeliacCare" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="#string/activity_name" android:launchMode="singleTop" android:name="app" android:theme="#android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="#string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:exported="true" android:name="com.plugin.gcm.PushHandlerActivity" />
<receiver android:name="com.plugin.gcm.CordovaGCMBroadcastReceiver" 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.app" />
</intent-filter>
</receiver>
<service android:name="com.plugin.gcm.GCMIntentService" />
</application>
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="com.app.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.app.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
</manifest>
Try to look if you are sending the notification payload with this structure:
{
message : "message"
}
Related
I made an app which uses cordova plugin to run a SIPML5 web app.
When my app runs in background, if i open camera, the record button is disabled.
If I kill the app, sometimes the record button is enabled again.
I don't know how to fix this. My app does not uses.
Here is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.alonia"
android:hardwareAccelerated="true"
android:versionCode="2224"
android:versionName="2.0.0">
<uses-sdk
android:minSdkVersion="21"
android:targetSdkVersion="25" />
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:resizeable="true"
android:smallScreens="true"
android:xlargeScreens="true" />
<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.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:hardwareAccelerated="true"
android:icon="#mipmap/icon"
android:label="#string/app_name"
android:supportsRtl="true">
<activity
android:name=".MainActivity"
android:configChanges="orientation"
android:screenOrientation="portrait"
android:label="#string/activity_name"
android:launchMode="singleTop"
android:theme="#android:style/Theme.DeviceDefault.NoActionBar"
android:windowSoftInputMode="adjustPan">
<intent-filter android:label="#string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name=".AloniaRunOnStartup"
android:enabled="true"
android:exported="true"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<service
android:name=".AloniaService"
android:enabled="true"
android:exported="true">
</service>
</application>
</manifest>
Thanks,
Andi
It's because, unfortunately, two android apps cannot have access to the same mic at the same time. This is a broadcast issue and so because of your "record audio" permission, your camera won't be able to record.
Here's another link of people trying to do the same: https://issuetracker.google.com/issues/36982217
I am developing an hybrid app using Ionic Framework. The app works fine and I have published it to app store which I did not exclude any device from it.
Recently I bought a very cheap brand 7 inch tablet PC running on Android 4.4.2. I am able to build and install directly into the tablet. The app works fine on it. But why is that when I check on Google play store, I can't see my app listing from that device. When I try to access my app from browser, the app store says "This app is incompatible with your device".
Why is it incompatible as the app works fine when I manually install to it? How can I get my app listed on the device? What are the settings can I change?
AndroidManifest.xml
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="5" android:versionName="0.0.5" package="com.company.appname" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<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" />
<application android:hardwareAccelerated="true" android:icon="#drawable/icon" android:label="#string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="#string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:screenOrientation="portrait" android:theme="#android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="#string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="com.company.appname.MESSAGE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/fb_app_id" />
<activity android:label="#string/fb_app_name" android:name="com.facebook.LoginActivity" android:theme="#android:style/Theme.Translucent.NoTitleBar" />
<activity android:label="#string/multi_app_name" android:name="com.synconset.MultiImageChooserActivity" android:theme="#android:style/Theme.Holo.Light" />
<receiver android:name="com.pushbots.google.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.company.appname" />
</intent-filter>
</receiver>
<receiver android:name="com.pushbots.plugin.PushHandler" />
<receiver android:name="com.pushbots.push.DefaultPushHandler" />
<service android:name="com.pushbots.push.GCMIntentService" />
<activity android:name="org.cloudsky.cordovaPlugins.ZBarScannerActivity" android:screenOrientation="portrait" android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen" />
</application>
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="22" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<permission android:name="com.company.appname.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.company.appname.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
<uses-feature android:name="android.hardware.camera.flash" android:required="false" />
<uses-feature android:name="android.hardware.camera.front" android:required="false" />
<uses-permission android:name="android.permission.CAMERA" />
</manifest>
I am having trouble getting Push Notifications to work in my Unity application on Android. I have followed the steps in the Parse documentation, including setting up the AndroidManifest.xml. The device registers an installation, which I can see on the dashboard. However, when using the dashboard to create a Push the delivery report always says "PPNS - OUTDATED DEVICE" for my tablet.
I followed the instructions for creating the AndroidManifest.xml file from here:
https://www.parse.com/apps/quickstart#parse_push/unity/android/existing
Do I need to set the "GCMSenderId" value of the installation? The documentation was kind of ambiguous on that.
Here are the contents of my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.unity3d.player"
android:installLocation="preferExternal"
android:versionCode="1"
android:versionName="1.0">
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:protectionLevel="signature"
android:name="com.unity3d.player.permission.C2D_MESSAGE" />
<uses-permission android:name="com.unity3d.player.permission.C2D_MESSAGE" />
<application
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:debuggable="true"> <!-- SET TO FALSE FOR RELEASE BUILD -->
<activity android:name="com.unity3d.player.UnityPlayerActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
<service android:name="com.parse.ParsePushService" />
<receiver android:name="com.parse.ParsePushBroadcastReceiver"
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.unity3d.player" />
</intent-filter>
</receiver>
</application>
</manifest>
OK, so I've figured it out. I had a few things wrong with the manifest file, but the most important thing was changing the package name from the default of "com.unity3d.player". I had another test Unity app on the device using the same default package name, and I believe that because it was installed first it was intercepting the notifications.
Anyway, here is my AndroidManifest.xml file for anyone else having trouble with Parse Push using Unity3D and Android devices.
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yourcompany.yourproductname"
android:installLocation="preferExternal"
android:versionCode="1"
android:versionName="1.0">
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:protectionLevel="signature"
android:name="com.yourcompany.yourproductname.permission.C2D_MESSAGE" />
<uses-permission android:name="com.yourcompany.yourproductname.permission.C2D_MESSAGE" />
<application
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:debuggable="true"> <!-- SET TO FALSE FOR RELEASE BUILD -->
<activity android:name="com.unity3d.player.UnityPlayerActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
<service android:name="com.parse.ParsePushService" />
<receiver android:name="com.parse.ParsePushBroadcastReceiver"
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.yourcompany.yourproductname" />
</intent-filter>
</receiver>
</application>
</manifest>
Note that you would replace all instances of "com.yourcompany.yourproductname" with whatever package name you want to use.
We've build a PhoneGap / Cordova app and use the PushPlugin for handling push notifications.
On the Galaxy S3 (Android 4.1.2) everything works fine, we do receive push notifications. However, on the Galaxy S2 (also Android 4.1.2) we don't receive push notifications (although we DO receive the devicetoken).
As both deviced are running the same Android version, they have the same API level. Also because it works on newer (S3) devices, I assume the code is OK.
Here's our AndroidManifest.xml:
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="8" android:versionName="1.0.0" android:windowSoftInputMode="adjustPan" package="com.APPHQ.APPNAME" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="com.APPHQ.APPNAME.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.APPHQ.APPNAME.permission.C2D_MESSAGE" />
<application android:allowBackup="true" android:hardwareAccelerated="true" android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="#string/app_name" android:name="APPNAME" android:theme="#android:style/Theme.Black.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.plugin.gcm.PushHandlerActivity" />
<receiver android:name="com.plugin.gcm.CordovaGCMBroadcastReceiver" 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.APPHQ.APPNAME" />
</intent-filter>
</receiver>
<service android:name="com.plugin.gcm.GCMIntentService" />
</application>
</manifest>
Any idea what we need to do to get push notifications working on the S2?
Many thanks!
Robin
You must have checked this but still want to remind you to check below things for GCM to work on the device
The device should be configured with one valid gmail account
The Android Market (Play store) must be logged in (You should accept the terms and license)
The Data connection is properly working
I guess your main package is "com.APPHQ.APPNAME".
Place your GCMIntentService class inside this package and declare it in manifest file as follows :
<service android:name=".GCMIntentService" />
Hope this helps.
I have built a Android HTML5 app using Phonegap which uses an iframe to process payments via system on a partner companies server.
The system drops a cookie with an inbox code on the phone which means that once the user has register once - the system uses the cookie to save them re-registering - all worked fine until time for launch and now it will only work on wifi and not on 3G!?
This has all previously worked - so it doesn't make any logical sense to me! I wondered whether it could be due to a permission change in my manifest file? (which is below)
Does anybody have any ideas at all?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.phonegap.chillimusicapp"
android:versionCode="1"
android:versionName="1.0" >
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:resizeable="true"
android:anyDensity="true"
/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-sdk android:minSdkVersion="7" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
>
<activity android:name="com.phonegap.DroidGap" android:label="#string/app_name">
<intent-filter>
</intent-filter>
</activity>
<activity
android:label="#string/app_name"
android:debuggable="true"
android:name=".ChilliMusicAPPActivity"
android:configChanges="orientation|keyboardHidden"
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="com.phonegap.DroidGap" android:label="#string/app_name" > <intent-filter> </intent-filter> </activity>
<activity android:name="com.phonegap.DroidGap" android:screenOrientation="portrait"> <intent-filter> </intent-filter> </activity>
</application>
</manifest>