broadcast intent callback: result=CANCELLED forIntent - java

I have a mobile app, that registers to a c2dm server.
I have a server that sends a message to my app, to push a notification. The server receives ok result code from google c2dm.
In LogCat i see that my app receives the message but immediately produces the error i have in my post. And also the notification that i created is ignored.
08-10 16:28:09.157: W/GTalkService(13962): [DataMsgMgr] broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE pkg=com.example.c2dmclient (has extras) }
i don't get it.
My manifest file is:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.c2dmclient"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<permission android:name="com.example.c2dmclient.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.example.c2dmclient.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<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" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".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>
<receiver
android:name=".C2DMRegistrationReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter >
<action android:name="com.google.android.c2dm.intent.REGISTRATION" >
</action>
<category android:name="com.example.c2dmclient" />
</intent-filter>
</receiver>
<receiver
android:name=".C2DMMessageReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter >
<action android:name="com.google.android.c2dm.intent.RECEIVE" >
</action>
<category android:name="com.example.c2dmclient" />
</intent-filter>
</receiver>
<activity android:name="com.example.c2dmclient.RegistrationResultActivity" >
</activity>
<activity android:name="com.example.c2dmclient.MessageReceivedActivity" >
</activity>
</application>
</manifest>
If someone could help me please. i'm out of ideas

According to this forum post the situation arises in Android 3.1+ when the receiving app is in stopped state on the device (for example by using force stop from the settings). It will only start to receive messages again when it is manually started.
See also this post

Finally i have found where was the problem. When i was creating the notification, in the place of logo id, i have put 0. Now all it's working.

Related

Android App ist running on Device in USB-Debug-Mode but not after APK-Install

I am very new In Android Development and developed a "Time Stamp Clock - App" which reads NFC-Tags.
Everything fine, it is running on Device via USB-Debug-Mode without Errors as expected. When I build APK and install on the same Device, the installing is without errors, but after that, the open-button is grayed out and inactive and there is no desktop-icon to launch. In the APPS Overview it is displayed, but not able to open.
Can someone tell me, what can i do, to figure it out, what is going wrong there?
EDIT:
Manifest:
<?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.example.comidoszeiterfassung">
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-sdk android:minSdkVersion="21"
android:targetSdkVersion="30"></uses-sdk>
<application
android:name=".myGLOBAL"
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.ComidosZeiterfassung"
tools:ignore="Instantiatable">
<activity
android:name=".ui.login.MainActivity"
android:label="#string/title_activity_main"
android:theme="#style/Theme.ComidosZeiterfassung.NoActionBar"
android:exported="true">
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<data android:mimeType="text/plain" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".ui.login.LoginActivity"
android:label="#string/app_name"
android:exported="true">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
</application>
</manifest>
It is a simple structure in the app. LoginActivity as Start-Activity and a TabbedActivity for the NFC-Stuff.

logcat report of push not being enabled correclty

I'm using Parse as a back end for my app and I used their quick start guide to setup push notifications.
I've followed it step by step and do not get pushes. Also I get this report in logcat when I start the app
08-22 18:46:34.785 4325-4325/maxbleggi.afstudentplanner D/com.parse.ParsePushChannelsController﹕ Tried to subscribe or unsubscribe from a channel, but push is not enabled correctly. Push is not configured for this app because the app manifest is missing required declarations. Please add the following declarations to your app manifest to use GCM for push: make sure that these permissions are declared as children of the root <manifest> element:
<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:name="maxbleggi.afstudentplanner.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="maxbleggi.afstudentplanner.permission.C2D_MESSAGE" />
Also, please make sure that these services and broadcast receivers are declared as children of the <application> element:
<service android:name="com.parse.PushService" />
<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" />
<category android:name="maxbleggi.afstudentplanner" />
</intent-filter>
</receiver>
<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.OPEN" />
<action android:name="com.parse.push.intent.DELETE" />
</intent-filter>
</receiver>
But I followed the guide and I believe my manifest is correct
here it is
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="maxbleggi.afstudentplanner" >
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<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.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission
android:name="maxbleggi.afstudentplanner.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="maxbleggi.afstudentplanner.permission.C2D_MESSAGE" />
<application
android:name=".utils.InitializeParse"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".activities.MainActivity"
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=".activities.RegisterActivity"
android:label="#string/title_activity_register" >
</activity>
<activity
android:name=".activities.RegisterPart_2Activity"
android:label="#string/title_activity_register_part_2" >
</activity>
<activity
android:name=".activities.RegisterPart2TeacherActivity"
android:label="#string/title_activity_register_part2_teacher" >
</activity>
<activity
android:name=".activities.SplashScreenActivity"
android:label="#string/title_activity_splash_screen" >
</activity>
<activity
android:name=".activities.RegisterPart_3TeacherActivity"
android:label="#string/title_activity_register_part_3_teacher" >
</activity>
<!--<meta-data android:name="com.parse.push.notification_icon"/>
android:resource="#drawable/ic_stat_bt"-->
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParseBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.RECEIVE_BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
<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.OPEN" />
<action android:name="com.parse.push.intent.DELETE" />
</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" />
<category android:name="maxbleggi.afstudentplanner" />
</intent-filter>
</receiver>
</application>
</manifest>
here is where I start parse
...
Parse.setLogLevel(Parse.LOG_LEVEL_DEBUG);
ParseInstallation.getCurrentInstallation().saveInBackground();
ParsePush.subscribeInBackground("", new SaveCallback()
{
#Override
public void done(ParseException e)
{
if (e == null)
{
} else
{
}
}
});
When I use my device I do not receive this logcat report but I do receive it when I use an emulator
If using Genymotion as emulator and it does not have Google Apps installed on it, that might cause the issue. Try to Install ARM translation and check again. For more see Unable to get push notification when using Genymotion as my emulator of my android app
I know there could be complex emulator problems but picking a simple one you seem to be missing a permission
<uses-permission android:name="maxbleggi.afstudentplanner.permission.C2D_MESSAGE" />

How to share a photo from gallery via My application

I just want my application make available for user to share a Photo from gallery using Share Via Intent Chooser. Additionally i want to perform basic action of my application just after choosing my application from share via Screen like watsapp. I don't have any idea about how to do. I searched around the Internet but i didn't get any satisfactory Solution. Infect i tried with this
but unfortunately using this code in manifest my application is got disappeared from the Home Screen Application list in my device.
have a look over my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.app.myAppName"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="preferExternal"
>
<uses-sdk
android:minSdkVersion="8"
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.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<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="android.permission.RECORD_AUDIO" >
</uses-permission>
<!-- 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.
NOTE: the permission *must* be called PACKAGE.permission.C2D_MESSAGE,
where PACKAGE is the application's package name.
-->
<permission
android:name="com.app.myAppName.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.app.myAppName.permission.C2D_MESSAGE" />
<!-- This app has permission to register and receive data message. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- Keeps the device on vibrating mode when a message is received. -->
<uses-permission android:name="android.permission.VIBRATE" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-feature android:name="android.hardware.camera.front" />
<application
android:name="com.app.myAppName.TwitterApplication"
android:allowBackup="true"
android:icon="#drawable/logo"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.app.myAppName.SplashScreen"
android:label="#string/app_name"
android:theme="#android:style/Theme.Black.NoTitleBar" >
<intent-filter>
<!--
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
-->
<action android:name="android.intent.action.SEND" >
</action>
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" >
</data>
</intent-filter>
</activity>
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/app_id" />
<service
android:name=".TimelinesService"
android:label="Timelines Service" />
<service
android:name=".NotificationService"
android:label="NotificationService" />
<activity
android:name="com.facebook.LoginActivity"
android:label="#string/app_name" >
</activity>
<activity
android:name="LoginActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Black.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="tweeter"
android:scheme="callback" />
</intent-filter>
</activity>
<activity android:name="com.app.myAppName.TweetsActivity" >
</activity>
<activity
android:name="HomeActivity"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Black.NoTitleBar" >
</activity>
<activity
android:name="TwitterLogin"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Black.NoTitleBar" >
</activity>
<activity
android:name="AddUser"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="AddmyAppName"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="AddMemberTransparent"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Translucent.NoTitleBar" >
</activity>
<activity
android:name="AddAFriendActivity"
android:screenOrientation="portrait" >
</activity>
</application>
You application 'disappeared' because you commented these lines at SplashActivity section:
<!--
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
-->
as for share provider, which part are you stuck at?

GCM receiver package not found

I'm studying GCM (Google Cloud Messaging, old deprecated name is C2DM). I use different devices . operations run well , even if app is closed . but on nexus tablet, an error occurs when app is closed. if app is in progress , my GCM codes works on all devices that I try .
Now : I looked for these problem and I found there was an error manifests of others . If my manifest is wrong , why do ohter devices except nexus tablet, execute my codes properly ?
Could I think that my manifest is wrong?
this is my manifests :
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.borda.C2DM"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<permission android:name="android.borda.C2DM.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="android.borda.C2DM.permission.C2D_MESSAGE" />
<!-- 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" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".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>
<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="android.borda.C2DM" />
</intent-filter>
</receiver>
<service android:name=".GCMIntentService" />
</application>
</manifest>
an error occurs when app is closed
What kind of error?
If you just can't receive gcm messages in your app (android 3.1+) when app is closed - take look on that question.

Android receive sms only works in emulator (onReceive not called?)

Iam coding a little gps tracker wo sends me the gps coordinates when it receives a sms.
It works with 2 emulators and I get the message with the gps coordinates.
Then I tried it on my HTC Desire and send myself an sms.
But nothing happend!
Normally when the onReceive is called it shows a message with toast and sends an sms with gps coordinates but nothing is happening ;-/
Here the manifest:
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".GPSActivity"
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=".SmsReceiver" android:enabled="true">
<intent-filter>
<action android:name=
"android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
</application>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
any ideas?
Ps.: The code is in my last thread HERE
THANKS!

Categories