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.
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 new to Hybrid Android applications using Cordova and salesforce.
I have built a signed APK and ZipAligned it.
But when I am uploading it to app store it gives me following error:
Following is my Manifest file:
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="1.0.1" package="com.thehub.app" 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="17" android:targetSdkVersion="23" />
<permission android:name="com.thehub.app.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_SERVICE" />
<uses-permission android:name="com.thehub.app.permission.C2D_MESSAGE" />
<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-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<application android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="#drawable/thehub"
android:label="#string/app_name"
android:manageSpaceActivity="com.salesforce.androidsdk.ui.ManageSpaceActivity" >
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
android:label="#string/app_name"
android:launchMode="singleTop"
android:name="com.salesforce.androidsdk.ui.sfhybrid.SalesforceDroidGapActivity"
android:screenOrientation="portrait"
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:label="#string/app_name" android:name="com.synconset.MultiImageChooserActivity" android:screenOrientation="portrait" android:theme="#android:style/Theme.Holo.Light">
<intent-filter />
</activity>
<activity android:exported="true" android:label="#string/app_name" android:name="com.plugin.gcm.PushHandlerActivity" android:screenOrientation="portrait" />
<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.thehub.app" />
</intent-filter>
</receiver>
<service android:name="com.plugin.gcm.GCMIntentService" />
</application>
</manifest>
I am not able to locate where in the Manifest file I am doing it wrong.
Any help is appreciated.
Thanks in advance.
Got the answer from this post
http://salesforce.stackexchange.com/questions/69566/mobile-sdk-android-aapt-error
In the SalesforceSDK plugin
Just changed the
android:name="#string/app_package"
to
android:name="com.salesforce.androidsdk"
Well, i register an app in Parse, when i test my app, the app send my installation information but the GCMSenderIr and deviceToken are undefined. this is my AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.nativescript.SampleNotify"
android:versionCode="1"
android:versionName="1.0" >
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"/>
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="22"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<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.VIBRATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!--
IMPORTANT: Change "com.parse.starter.permission.C2D_MESSAGE" in the lines below
to match your app's package name + ".permission.C2D_MESSAGE".
-->
<permission android:protectionLevel="signature"
android:name="org.nativescript.SampleNotify.C2D_MESSAGE" />
<uses-permission android:name="org.nativescript.SampleNotify.C2D_MESSAGE" />
<application
android:name="com.tns.NativeScriptApplication"
android:allowBackup="true"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.tns.NativeScriptActivity"
android:label="#string/title_activity_kimera"
android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.tns.ErrorReportActivity"/>
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParsePushBroadcastReceiver"
android:exported="false">
<intent-filter>
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.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" />
<!--
IMPORTANT: Change "com.parse.starter" to match your app's package name.
-->
<category android:name="org.nativescript.SampleNotify" />
</intent-filter>
</receiver>
</application>
</manifest>
and this is my code
public void onCreate() {
Parse.initialize(this, "xxxxxxxx", "xxxxxxx");
ParseInstallation.getCurrentInstallation().saveInBackground();
}
I no get any error, but i not get these information
Row in Parse
here a capture, thank you
OK. so, you can check the next:
Ensure your class "com.tns.NativeScriptApplication" are extending from Application (why both packages are different? org.nativescript.SampleNotify != com.tns)
Check my configuration: https://github.com/tiveor/android-advanced/blob/master/ParsePushTest/app/src/main/AndroidManifest.xml
Review your onCreate code that is implementing super.onCreate https://github.com/tiveor/android-advanced/blob/master/ParsePushTest/app/src/main/java/com/possiblelabs/parsepushtest/MyApplication.java
Check your AppId and Client Key (could have some extra space).
If you didn't, you need to add dependency to Google Cloud Messaging Play Services library in order to let Parse get the GCM registration token.
Check dependencies in your build.gradle and add if necessary:
compile "com.google.android.gms:play-services:8.3.0"
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"
}
I'm using one device for testing and I'm getting a lot of new registration IDs from it. Not every time the app is built, but sometimes. I'm not sure what the deal is. How do I get it to use the same id? Isn't that what is supposed to happen?
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="company.android.phone.TheApp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<!-- for push notifications -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- App receives GCM messages. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- GCM connects to Google Services. -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- 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" />
<!-- For performance testing a trace file is saved to the SD card -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.GET_TASKS" />
<permission android:name="company.android.phone.TheApp.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="company.android.phone.TheApp.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<supports-screens
android:resizeable="true"
android:smallScreens="false"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="false"
android:anyDensity="true" />
<application
android:icon="#drawable/app_icon"
android:label="#string/app_name" >
<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" />
<category android:name="company.android.phone.TheApp" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="company.android.phone.TheApp" />
</intent-filter>
</receiver>
<activity
android:name=".SplashActivity"
android:theme="#style/Theme.Splash"
android:screenOrientation="portrait"
android:noHistory="true" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:label="#string/app_name"
android:windowSoftInputMode="stateVisible|adjustPan"
android:name=".TheAppActivity"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".MainActivity"
android:windowSoftInputMode="stateVisible|adjustPan"
android:screenOrientation="portrait" />
<activity android:name=".WebViewActivity"
android:windowSoftInputMode="stateVisible|adjustPan"
android:screenOrientation="portrait" />
<service android:name=".GCMIntentService" />
</application>
</manifest>
You have no warranty that your Registration Id will always be the same for your device.
The registration ID lasts until the Android application explicitly
unregisters itself, or until Google refreshes the registration ID for
your Android application.
For more info look here "Enabling GCM":
http://developer.android.com/guide/google/gcm/gcm.html