android.intent.action.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE what's the use? - android

I am trying to execute the OnReceive method when Android starts so that I can schedule
a task.
Unfortunately onReceive of my BradcastReciever is called at boot only if I install the app on the
root system. I thought that android.intent.action.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE
should fix the problem.
But from this post it seems that it is not possible, though in certain tutorials
they say it is feasible.
Android installLocation and BOOT_COMPLETED
I should infer that I cannot do such a thing.
Is that really so or there is a way to get the broadcast at startup with my app on the sd.
If it is not possible I wonder what's the use
of android.intent.action.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE
This is my Manifest in case someone wnat to take a look.
I am testing on Android 2.3.7
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="mypackage"
android:installLocation="preferExternal"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="17" />
<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.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
.............................
<receiver
android:name="mypackage.MyNotificationReceiver"
android:enabled="true"
>
<intent-filter android:priority="1" >
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE" />
</intent-filter>
</receiver>
</application>
</manifest>
Thanks

First you have to split intent filter
Something like this:
<receiver
android:name="mypackage.MyNotificationReceiver"
android:enabled="true"
>
<intent-filter android:priority="1" >
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE" />
</intent-filter>
</receiver>
Every filter should have only one action.
Second, a question: ACTION_EXTERNAL_APPLICATIONS_AVAILABLE occurs always some time after BOOT_COMPLETED (the device first completes boot, then reads card). So why both actions?

Related

Xamarin Forms - PCL project The app could not be started

I am using Visual Studio 2015 and have a PCL based project created. All this application does is show a splash screen and then navigate to the next page. I am unable to get this to work on Android. Here is the link for the splash screen
The error I get:
The application could not be started. Ensure that the application has
been installed to the target device and has a launchable activity
(MainLauncher = true).
Additionally, check Build->Configuration Manager to ensure this
project is set to Deploy for this configuration.
I have followed this link and tried all the solutions there and still have the same result
Any tips to fix this?
Edit
Android Manifest File
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="Splash.Splash" android:installLocation="auto" android:versionCode="1" android:versionName="1.0">
<!--suppress UsesMinSdkAttributes-->
<uses-sdk android:minSdkVersion="15" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application android:icon="#drawable/icon-3" android:name="mono.android.app.Application" android:allowBackup="true" android:label="Splash.Splash" android:debuggable="true">
<activity android:label="Splash screen" android:name="md5ac585b47313c1dc414c7b7a18f93e457.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:icon="#drawable/icon-3" android:noHistory="true" android:theme="#style/Theme.Splash" android:name="md5ac585b47313c1dc414c7b7a18f93e457.Splash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider android:name="mono.MonoRuntimeProvider" android:exported="false" android:initOrder="2147483647" android:authorities="Splash.Splash.mono.MonoRuntimeProvider.__mono_init__" />
<!--suppress ExportedReceiver-->
<receiver android:name="mono.android.Seppuku">
<intent-filter>
<action android:name="mono.android.intent.action.SEPPUKU" />
<category android:name="mono.android.intent.category.SEPPUKU.STM.STM" />
</intent-filter>
</receiver>
</application>
</manifest>
Edit
New Manifest below
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="Super.Super" android:installLocation="auto">
<uses-sdk android:minSdkVersion="15" />
<application android:icon="#drawable/stmicon-3"></application>
</manifest>
EDITED: There was more than one problem in your question. I addressed two of them but the last one was the icon name.
Android resources can't have the '-' character in the name.
so this is the correction:
<application android:icon="#drawable/stmicon3"></application>
Initial answer:
Its wrong to have two activities with the same intent filter for launching.
So, first on your Manifest, remove entirely the two Activities tags.
For helping debugging this. please change your manifest to this (yes we are ignoring the Provider too)
So your final Manifest would be:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.yournamespace.courier">
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="22" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application android:label="yournamespace">
</application>
</manifest>
After this, were gonna set the SplashActivity as MainLauncher:
[Activity(MainLauncher = true,
NoHistory = true)]
public class SplashActivity : AppCompatActivity
And finally the MainActivity:
[Activity(Icon = "#drawable/icon")]
public class MainActivity : FormsAppCompatActivity
You Can Do As Jon Sugguested Or Just Go Into Your Android Device Settings & Application Manager And uninstall the previous version of the application on your android device

Android device not showing alert in response to remote push notification when the app is not running

I saw many other questions on here saying if an app is force stopped it won't receive notifications.
However, I AM NOT force stopping this app. I am just hitting the back button. I have also tried just hitting the home button. In both cases no alerts.
However, if the app is running in the foreground the PushReceived event fires and the AData.Message shows the correct text. So, it would appear that remote notifications are being sent to the device, it's just that the app is never woken up to process them.
The app is written in Delphi XE8 and I have tested this on KitKat and JellyBean, both with the same results.
I suspect the problem is in the Android Manifest file. A copy of which is below. Beyond this I am not sure where to go. As I understand it when a push is received it is supposed to run a small bit of code in the Firemonkey framework that displays the push message without starting the full app.
I am using the app described in this tutorial to try to figure out why it is not working in my live app. This used to work as I expected it to in XE7.
http://docwiki.embarcadero.com/RADStudio/XE8/en/Mobile_Tutorial:_Using_Remote_Notifications_%28iOS_and_Android%29
I am using the Engagement Tab on the Kinvey dashboard to send the test pushes, so I assume the server side is correct. And as I said they are working with the app in the foreground.
Gary
<?xml version="1.0" encoding="utf-8"?>
<!-- BEGIN_INCLUDE(manifest) -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.gwsystemsdns.net.pushtest"
android:versionCode="1"
android:versionName="1.0.0"
android:installLocation="preferExternal">
<!-- This is the platform API where NativeActivity was introduced. -->
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="11" />
<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="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<permission android:name="net.gwsystemsdns.net.pushtest.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="net.gwsystemsdns.net.pushtest.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-feature android:glEsVersion="0x00020000" android:required="True"/>
<application android:persistent="False"
android:restoreAnyVersion="False"
android:label="PushTest"
android:debuggable="True"
android:largeHeap="False"
android:icon="#drawable/ic_launcher"
android:theme="#style/AppTheme"
android:hardwareAccelerated="true">
<!-- Our activity is a subclass of the built-in NativeActivity framework class.
This will take care of integrating with our NDK code. -->
<activity android:name="com.embarcadero.firemonkey.FMXNativeActivity"
android:label="PushTest"
android:configChanges="orientation|keyboard|keyboardHidden"
android:launchMode="singleTask">
<!-- Tell NativeActivity the name of our .so -->
<meta-data android:name="android.app.lib_name"
android:value="PushTest" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name="com.embarcadero.firemonkey.notifications.FMXNotificationAlarm" />
<receiver android:exported="true" android:name="com.embarcadero.gcm.notifications.GCMNotification" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="net.gwsystemsdns.net.pushtest" />
</intent-filter>
</receiver>
</application>
</manifest>
<!-- END_INCLUDE(manifest) -->
My Push Received event demonstrating the reception of foreground pushes.
procedure TfrmMain.PushEvents1PushReceived(Sender: TObject; const AData: TPushData);
begin
Memo1.Lines.Add('Push Received');
Memo1.Lines.Add('Push = ' + AData.Message);
end;
I found the problem. This line was missing from the XE8 manifest template file:
<%activity%>
<service android:name="com.embarcadero.gcm.notifications.GCMIntentService" />
<%receivers%>
</application>
It goes into the AndroidManifest.template.xml file like this (immediately following the <%receivers%> tag:
<%activity%>
<service android:name="com.embarcadero.gcm.notifications.GCMIntentService" />
<%receivers%>
<receiver android:name="com.embarcadero.firemonkey.notifications.FMXNotificationAlarm" />
</application>
As per Embarcadero's docwiki.

Parse Unity SDK does not work in an Android build

I use Parse Unity SDK as a solution for cloud storing of all the relevant gameplay statistics. The SDK works perfectly well in the Unity editor. However, when the project is built for Android and deployed on a device, not a single piece of functionality seems to be working - a user can't sign up, log in or place any kind of data into the Parse cloud.
I have tested this from within a simple project, to avoid possible 3rd party plugin conflicts, but the result was the same.
The AndroidManifest.xml file looks like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.toybox.parsetest"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="10" />
<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" />
<permission android:protectionLevel="signature" android:name="com.toybox.parsetest.permission.C2D_MESSAGE" />
<uses-permission android:name="com.toybox.parsetest.permission.C2D_MESSAGE" />
<application android:label="ParseTest" android:icon="#drawable/app_icon">
<activity android:name=".UnityPlayerActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<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.toybox.parsetest" />
</intent-filter>
</receiver>
<service android:name="com.parse.ParsePushService" />
</application>
</manifest>
You might want to follow this official bug thread for the issue...
https://developers.facebook.com/bugs/1623483557935932/
EDIT : At the bottom of the thread the developer has posted a package, which seems to have some other files and a manifest in the Plugins/Android folder. It seems you need to make sure you keep these files, and it will work.
You can download the package from
https://www.dropbox.com/s/oc0orevllrf1ylm/Fixed-Parse-Unity-Android-Bug-1.5.2.zip?dl=0

GCM Notifications are ignored on the device

I'm trying to do some GCM notifications on Android. I've come as far as having something happen on the device.
NotificationService is throwing the following exception:
12-11 16:02:19.650 202-380/? E/NotificationService﹕ Ignoring notification with icon==0: Notification(contentView=org.***.**.reciever/0x1090098 vibrate=null,sound=null,defaults=0x0,flags=0x0)
Here is my manifest for reference:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.***.**.reciever"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="19" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<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"/>
<permission android:name="org.***.**.reciever.permission.C2D_MESSAGE"
android:protectionLevel="signature"/>
<uses-permission android:name="org.***.**.reciever.permission.C2D_MESSAGE" />
<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="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<!-- The following two permissions are not required to use
Google Maps Android API v2, but are recommended. -->
<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/***"
android:name=".***Application" >
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name="org.***.**.reciever.MapActivity"
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="util.GcmBroadcastReciever"
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="org.***.**.reciever" />
</intent-filter>
</receiver>
<service android:name="util.GcmIntentService" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="***"/>
</application>
All the *. are just the masked package name, they are all the same.
Any idea what I'm doing wrong?
Also, is the notification supposed to pop up on the device without any extra code or does the app have to ask the OS to show a notification on the screen when the GCM push arrives? I think i read something about Android doing this part differently from iOS.
Figured it out, it's not the actual push message that's causing the issue as i thought. So i was barking up the wrong tree for a couple hours.
It turns out it was the actual notification that had an issue because it was demo code from Google >.<
Replaced with proper code -> working.
Thanks for your time!

Specific device not receiving Google Cloud Messaging notifications

I have an application where I'm implementing Google Cloud Messaging notifications, but in a specific device the messages don't arrive. This device has the minimum requirements to use GCM (Android version 2.2, Play Store installed and an Google Account logged). In the log I see that the device is receiving the registration id and sending to the back-office where I have a list of devices registered.
My question is: Do I need to make extra configurations to make the device receive these notifications?
Here is the manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="br.com.testegcm"
android:versionCode="1"
android:versionName="1" >
<uses-sdk
android:minSdkVersion="7"
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.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="com.example.gcm.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.gcm.permission.C2D_MESSAGE" />
<application
android:name="TesteGCM"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<receiver
android:name="br.com.testegcm.GcmBroadcastReceiver"
android:exported="true"
android:enabled="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="br.com.testegcm" />
</intent-filter>
</receiver>
<service android:name="br.com.testegcm.GcmIntentService" />
<activity
android:name="br.com.testegcm.Home"
android:screenOrientation="portrait"
android:label="#string/app_name"
android:theme="#style/notitle" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Change this :
<permission android:name="com.example.gcm.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.gcm.permission.C2D_MESSAGE" />
to :
<permission android:name="br.com.testegcm.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="br.com.testegcm.permission.C2D_MESSAGE" />
Add the same issue and i eventually i realized that i need to change in the manifest, the broadcast receiver package name from com.example.gcm to my package name :
<!-- Push notifcations-->
<receiver
android:name=".BroadcastRecivers.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
<category android:name="com.example.gcm"/>
</intent-filter>
</receiver>
To
<!-- Push notifcations-->
<receiver
android:name=".BroadcastRecivers.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
<category android:name="MY PACKAGE NAME"/>
</intent-filter>
</receiver>
No apart from Android version 2.2, Play Store app installed and an Google Account logged in no other configuration is needed, Now there are only two cases left
1) Either there is some ambiguity in your code.
2) or may be it is a device specific issue.
I had the very same problem.My code would work on nexus4(Kitkat) but would fail to get me a notification from the appln server(via gcm server).For versions less that 4.0.4 you should make sure that you have your google account setup on your device for gcm to work. I had google account on my phone but the mistake I made was that my Account and Sync settings in my galaxy ace was 'Off'.When I turned it ON and ran my code, i received the notification.
Please check the following solution. if still didn't work, let me know.
Add RECEIVE and REGISTRATION Intent in two different intent filters
<receiver
android:name=“<.GCM BroadcastReceiver Name>“ // Name of your BroadcastReceiver, define in code.
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=“<Package Name>" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name=“<Package Name>" />
</intent-filter>
</receiver>
<service android:name=“<.GCM IntentService Name>" /> // Name of your IntentService, define in code.
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Add RECEIVE and REGISTRATION Intent in two different intent filters as shown as above otherwise it won’t work for some devices(Ex. HTC).

Categories

Resources