Xtify + Worklight 6.1 integration in android environment - android

We have been working on the integration between worklight and xtify for push notifications. We are using version 2.3.2 for xtify sdk since latest version (2.4.2) made the app failed because a class not found exception.
The logic for using xtify has been added to the native code of the WL hybrid application as follows:
public class XtifyWL extends WLDroidGap {
public static final String XTIFY_APP_KEY = "xxxxxxxx-xxxxx-xxxx-xxxxx-xxxxxxxxx";
public static final String PROJECT_NUM = "xxxxxxxxxxxx"; // This is the Google Project Number
#Override
protected void onStart() {
// TODO Auto-generated method stub
super.onStart();
XtifySDK.start(getApplicationContext(), XTIFY_APP_KEY, PROJECT_NUM);
}
We are receiving the push notifications, but they are duplicated. We received one notification for worklight that fails when you try to open it, and one more for the native application thats works correctly.
How can we fix it?
About the issue with the SDK 2.4.2.2
The exception with SDK 2.4.2.2 is:
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to get provider com.xtify.sdk.db.Provider: java.lang.ClassNotFoundException: com.xtify.sdk.db.Provider
at android.app.ActivityThread.installProvider(ActivityThread.java:4609)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4236)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4178)
at android.app.ActivityThread.access$1400(ActivityThread.java:134)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4867)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.xtify.sdk.db.Provider
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.ActivityThread.installProvider(ActivityThread.java:4594)
... 12 more
The only place where we see that class is in the AndroidManifest.xml
<provider android:name="com.xtify.sdk.db.Provider" android:authorities="com.XtifyApp.XTIFY_PROVIDER" android:exported="false" />
If we comment that line it fails with the next use of any class of the SDK. We have added the sdk .jar file to the libs folder of the android project and to the build path of the android project.
Thanks,

We have found why when we send a push notification, we see them duplicated (two notifications icons on the top).
It was an error in the AndroidManifest.xml, we added all the Xtify GCM configuration and we also left the worklight GCM configuration so we where registering two receivers.
But we have still the issue of "java.lang.ClassNotFoundException" when we try to use the latest Xtify SDK. Athough at least receiving simple notifications seems to work with the SDK 2.3.2.
This is the correct AndroidManifest.xml:
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.XtifyApp" android:versionCode="1" android:versionName="1.0">
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="18"/>
<supports-screens android:smallScreens="false" android:normalScreens="true" android:largeScreens="false"/>
<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"/>
<!-- Push permissions -->
<permission android:name="com.XtifyApp.permission.C2D_MESSAGE" android:protectionLevel="signature"/>
<uses-permission android:name="com.XtifyApp.permission.C2D_MESSAGE"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.USE_CREDENTIALS"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application android:label="#string/app_name" android:debuggable="true" android:icon="#drawable/icon">
<activity android:name=".XtifyApp" android:label="#string/app_name" android:configChanges="orientation|keyboardHidden|screenSize" android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="com.XtifyApp.XtifyApp.NOTIFICATION"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity android:name="com.worklight.common.WLPreferences" android:label="Worklight Settings"></activity>
<!-- Start XTIFY -->
<provider android:name="com.xtify.sdk.db.Provider" android:authorities="com.XtifyApp.XTIFY_PROVIDER" android:exported="false" />
<receiver android:name=".XtifyNotifier" >
<intent-filter>
<action android:name="com.xtify.sdk.NOTIFIER" />
</intent-filter>
</receiver>
<receiver android:name="com.xtify.sdk.c2dm.C2DMBroadcastReceiver" >
<intent-filter android:permission="com.google.android.c2dm.permission.SEND" >
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.XtifyApp" />
</intent-filter>
<intent-filter android:permission="com.google.android.c2dm.permission.SEND" >
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.XtifyApp" />
</intent-filter>
</receiver>
<receiver android:name="com.xtify.sdk.NotifActionReceiver" />
<receiver android:name="com.xtify.sdk.wi.AlarmReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.TIMEZONE_CHANGED" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<data android:scheme="package" />
</intent-filter>
</receiver>
<service android:name="com.xtify.sdk.location.LocationUpdateService" />
<service android:name="com.xtify.sdk.c2dm.C2DMIntentService" />
<service android:name="com.xtify.sdk.alarm.MetricsIntentService" />
<service android:name="com.xtify.sdk.alarm.TagIntentService" />
<service android:name="com.xtify.sdk.alarm.RegistrationIntentService" />
<service android:name="com.xtify.sdk.alarm.LocationIntentService" />
<!-- END XTIFY -->
<!-- Start Worklight GCM configuration -->
<!--
<service android:name=".GCMIntentService"/>
<service android:name=".ForegroundService"/>
<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="com.XtifyApp"/>
</intent-filter>
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
<category android:name="com.XtifyApp"/>
</intent-filter>
</receiver>
-->
<!-- END Worklight GCM configuration -->
</application>
</manifest>

Related

Your Main Activity class com.ryanheise.audioservice.AudioServiceActivity is not a subclass FlutterFragmentActivity

I'm trying to create music app uses just_audio & just_audio_background plugins, App is working fine but I'm trying to integrate Stripe from flutter_stripe plugin. I get an exception when click on checkout button. its look like class com.ryanheise.audioservice.AudioServiceActivity from just_audio_background conflicting with flutter_stripe plugin
Exception
Your Main Activity class com.ryanheise.audioservice.AudioServiceActivity is not a subclass FlutterFragmentActivity.
MainActivity.kt
package com.example.spotify
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.android.FlutterFragmentActivity
class MainActivity: FlutterFragmentActivity() {
}
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.spotify"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<application
android:label="spotify"
android:name="${applicationName}"
android:icon="#mipmap/ic_launcher"
android:usesCleartextTraffic="true">
<activity
android:name="com.ryanheise.audioservice.AudioServiceActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="#style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<service android:name="com.ryanheise.audioservice.AudioService"
android:foregroundServiceType="mediaPlayback"
android:exported="true" tools:ignore="Instantiatable">
<intent-filter>
<action android:name="android.media.browse.MediaBrowserService" />
</intent-filter>
</service>
<!-- ADD THIS "RECEIVER" element -->
<receiver android:name="com.ryanheise.audioservice.MediaButtonReceiver"
android:exported="true" tools:ignore="Instantiatable">
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
</receiver>
</application>
</manifest>
`
I tried custom activity defining directly into menifest but its not work. please help me I'm newbie
You can try AudioServiceFragmentActivity instead of AudioServiceActivity. More information about the different ways to define an audio service activity can be found in the audio_service documentation.

Android AIDL - Unable to start service Intent

The error I am receiving is
2022-01-28 11:10:42.186 1651-3045/? W/ActivityManager: Unable to start service Intent { act=nveeaidle pkg=com.rchan.nveeapplication } U=0: not found
I have ensured the following code in both my applications (client and server). In my server manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rchan.nveeapplication">
<uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
<application
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.NveeApplication">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name="com.rchan.nvee_sdk.detectedactivity.DetectedActivityService"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="nveeaidle" />
</intent-filter>
</service>
<receiver android:name="com.rchan.nvee_sdk.detectedactivity.DetectedActivityReceiver"/>
<!-- <receiver-->
<!-- android:name="com.rchan.nvee_sdk.detectedactivity.DetectedActivityReceiver"-->
<!-- android:exported="false"-->
<!-- android:process=":remote"-->
<!-- android:permission="com.google.android.gms.permission.ACTIVITY_RECOGNITION">-->
<!-- <intent-filter>-->
<!-- <action android:name="action.TRANSITIONS_DATA" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
</application>
</manifest>
In my client, I have this in my fragment:
private fun connectToRemoteService() {
val intent = Intent("nveeaidle")
val pack = "com.rchan.nveeapplication"
pack?.let {
intent.setPackage(pack)
activity?.applicationContext?.bindService(
intent, this, Context.BIND_AUTO_CREATE
)
}
}
I am not sure what is causing this warning, and I have tried out different solutions after searching on stackoverflow and google.
How do I test is:
Launch my server application
Launch my client application
I see the warning
Thank you for taking the time to read my question.
After recent changes, You can use <queries> <package android:name ="your package name" /> </queries>
https://developer.android.com/training/package-visibility/declaring
I did more searching and finally found the answer... All credits go to the SO answer here:
https://stackoverflow.com/a/55712326/3718584
TLDR:
Had to change the intent from implicit to explicit due to API 21
intent.setClassName("com.rchan.nveeapplication","com.rchan.nvee_sdk.detectedactivity.DetectedActivityService")

Parse.com push notifications don't get to devices on background

Today I've implemented Parse.com Push service in my app.
I've noticed that the push notifications are being sent only when the app is open. I've also noticed that whenever I'm turning on my device there is a message says "Unfortunately, tof has stopped". The Logcat says Unable to start receiver.
The full Logcat:
java.lang.RuntimeException: Unable to start receiver com.parse.ParseBroadcastReceiver: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context com.parse.ParsePlugins$Android.applicationContext()' on a null object reference
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2952)
at android.app.ActivityThread.access$1800(ActivityThread.java:172)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1499)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5832)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context com.parse.ParsePlugins$Android.applicationContext()' on a null object reference
at com.parse.Parse.checkContext(Parse.java:440)
at com.parse.Parse.getApplicationContext(Parse.java:270)
at com.parse.ManifestInfo.getContext(ManifestInfo.java:324)
at com.parse.ManifestInfo.getPackageManager(ManifestInfo.java:328)
at com.parse.ManifestInfo.getPackageInfo(ManifestInfo.java:358)
at com.parse.ManifestInfo.deviceSupportsGcm(ManifestInfo.java:446)
at com.parse.ManifestInfo.getPushType(ManifestInfo.java:212)
at com.parse.PushService.startServiceIfRequired(PushService.java:222)
at com.parse.ParseBroadcastReceiver.onReceive(ParseBroadcastReceiver.java:19)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2945)
at android.app.ActivityThread.access$1800(ActivityThread.java:172)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1499)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:145)
        at android.app.ActivityThread.main(ActivityThread.java:5832)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
I've tried to search on the Web but I didn't find any solution. I guess that it's something about the receiver background operation.
I need an answer as quickly as possible, so if you know a bit about Parse SDK and it's push topic so please, help me 'cause I need to solve this today.
This is my code.
MainActivity.java:
ParsePush parsePush = new ParsePush();
ParseQuery pQuery = ParseInstallation.getQuery(); // <-- Installation query
pQuery.whereEqualTo("username", User_Name);
parsePush.sendMessageInBackground(message, pQuery);
AndroidManifest.xml:
<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="com.intap.tof.permission.C2D_MESSAGE" />
<uses-permission android:name="com.intap.tof.permission.C2D_MESSAGE" />
...
<service android:name="com.parse.PushService" />
<receiver android:name="com.intap.tof.Receiver"
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="com.intap.tof" />
</intent-filter>
</receiver>
I also have this line on Receiver.java:
package com.intap.tof;
import android.content.Context;
import android.content.Intent;
import com.parse.ParsePushBroadcastReceiver;
public class Receiver extends ParsePushBroadcastReceiver {
#Override
public void onPushOpen(Context context, Intent intent) {
Intent i = new Intent(context, MainActivity.class);
i.putExtras(intent.getExtras());
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
}
I need major help right now!! Please help me!
Follow the steps below. This code works fine and run the receiver on background. The original answer link: https://www.parse.com/apps/quickstart#parse_push/android/native/existing
MainActivity.java file
public void onCreate() {
Parse.initialize(this, "APPLICATION ID", "CLIENT KEY");
ParseInstallation.getCurrentInstallation().saveInBackground();
}
AndroidManifest.xml file
<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.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.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="com.parse.starter" />
</intent-filter>
</receiver>
Permissions.
<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="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="com.parse.starter.permission.C2D_MESSAGE" />
<uses-permission android:name="com.parse.starter.permission.C2D_MESSAGE" />
Have a look at this.
public class MainApplication extends Application {
private static MainApplication instance = new MainApplication();
public MainApplication() {
instance = this;
}
public static Context getContext() {
return instance;
}
#Override
public void onCreate() {
super.onCreate();
Parse.initialize(this, " ", " ");
PushService.setDefaultPushCallback(this, FabulaClient.class);
PushService.subscribe(this, "Barca", FabulaClient.class);
ParseInstallation.getCurrentInstallation().saveInBackground();
}
}
taken from https://www.parse.com/questions/cannot-send-push-to-android-after-app-is-closed-until-screen-unlock
I've understood why I don't get the push notifications on background.
I've initialized parse sdk twice - on the OpenActivity.java and on ParseApplication.java. I've removed it from the OpenActivity.java and added this code line:
android:name=".ParseApplication"
To the application attribute on the AndroidManifest.xml and now I can get push notifications on background.

Unexpectedly Closed Application After Integration Parse.com

There was no problem while running my little android application. I integrated my application new feature. I am using real time push notification with using ready script by www.parse.com . There is no problem while running but when i closed screen and reopen .There is an error. Your application closed unexpectedly. I dont know why and there is no log.
I am using this code in my main activity before oncreate
Parse.initialize(this, "XXX", "YYY");
PushService.setDefaultPushCallback(this, MainActivity.class);
ParseInstallation.getCurrentInstallation().saveInBackground();
ParseAnalytics.trackAppOpened(getIntent());
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.islamiceducationquestions.v1"
android:versionCode="13"
android:versionName="8.0.1">
<uses-sdk android:minSdkVersion="14" 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.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<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="com.islamiceducationquestions.v1.permission.C2D_MESSAGE" />
<uses-permission android:name="com.islamiceducationquestions.v1.permission.C2D_MESSAGE" />
<application
android:label="#string/app_name"
android:icon="#drawable/ic_launcher"
android:theme="#android:style/Theme.Holo.Light.DarkActionBar">
<activity
android:name=".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>
<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.USER_PRESENT" />
</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="com.islamiceducationquestions.v1" />
</intent-filter>
</receiver>
</application>
</manifest>
Log is :
java.lang.RuntimeException: Unable to start receiver com.parse.ParseBroadcastReceiver: java.lang.RuntimeException: applicationContext is null. You must call Parse.initialize(context, applicationId, clientKey) before using the Parse library.
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2844)
at android.app.ActivityThread.access$1700(ActivityThread.java:156)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1440)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5867)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:674)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: applicationContext is null. You must call Parse.initialize(context, applicationId, clientKey) before using the Parse library.
at com.parse.Parse.checkContext(Parse.java:583)
at com.parse.Parse.getApplicationContext(Parse.java:191)
at com.parse.ManifestInfo.getContext(ManifestInfo.java:241)
at com.parse.ManifestInfo.getPackageManager(ManifestInfo.java:249)
at com.parse.ManifestInfo.getPackageInfo(ManifestInfo.java:272)
at com.parse.ManifestInfo.deviceSupportsGcm(ManifestInfo.java:357)
at com.parse.ManifestInfo.getPushType(ManifestInfo.java:129)
at com.parse.PushService.startServiceIfRequired(PushService.java:150)
at com.parse.ParseBroadcastReceiver.onReceive(ParseBroadcastReceiver.java:19)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2833)
... 10 more
As you can see here Android Parse.com Simple ListView Tutorial you will need to call Parse.initialize from Application's onCreate instead of from Activity or Service. do it as:
public class ParseApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
// Add your initialization code here
Parse.initialize(this, YOUR_APPLICATION_ID, YOUR_CLIENT_KEY);
}
}
Also add ParseApplication in AndroidManifest.xml as application tag name:
<application
android:label="#string/app_name"
android:icon="#drawable/ic_launcher"
android:name="ParseApplication"
....

Android Permission Denial: broadcasting Intent

I really do not know what is wrong, but my if widget is update by system by "APPWIDGET_UPDATE" it throws following exception. I tried several things, exporting receiver (true/false), I tried it on emulators and real phones, but it is same. I added several intent-filters, but it did not work.
11-06 20:10:10.279: W/ActivityManager(61): Permission denied: checkComponentPermission() reqUid=1000
11-06 20:10:10.279: W/ActivityManager(61): Permission Denial: broadcasting Intent { act=android.appwidget.action.APPWIDGET_UPDATE (has extras) } from com.ency.easychange (pid=1196, uid=10034) requires null due to receiver com.android.settings/com.android.settings.widget.SettingsAppWidgetProvider
My AppWidgetProvider is only declared, because I tried to eliminate possibilities, but the exception is throw before ExchangeRateWidgetProvider.onReceive() is called.
public class ExchangeRateWidgetProvider extends AppWidgetProvider {
public static final String tag = "ExchangeRateWidgetProvider";
#Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager,
int[] appWidgetIds) {
}
}
My Manifest:
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- TODO: Remove, only for traces -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:icon="#drawable/ic_launcher_main"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".EasyChange"
android:label="#string/title_activity_easy_change" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".ExchangeRateWidgetService"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.appwidget.action.APPWIDGET_ENABLED" />
</intent-filter>
</service>
<receiver
android:name=".ExchangeRateWidgetProvider"
android:label="#string/exchange_rate_widget_name"
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="android.intent.action.MAIN" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/exchange_rate_widget_providerinfo" />
</receiver>
<activity
android:name=".WidgetConfigSmall"
android:label="#string/title_activity_widget_config_small"
android:theme="#android:style/Theme.Holo.Dialog"
android:excludeFromRecents="true"
android:exported="true" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
</intent-filter>
</activity>
</application>
I appreciate if you can take a look ...
Your problem lies somewhere in your Java code, where you are attempting to send the android.appwidget.action.APPWIDGET_UPDATE broadcast. That is to be broadcast by the OS, not by apps, and that is what the Permission Denial is about.

Categories

Resources