parse-community / parse-sdk-android Goto Github PK
View Code? Open in Web Editor NEWThe Android SDK for Parse Platform
Home Page: https://parseplatform.org/
License: Other
The Android SDK for Parse Platform
Home Page: https://parseplatform.org/
License: Other
Currently ParseObject
tracks changes to mutable containers such as List
, Map
, JSONArray
, and JSONObject
passed in through put(String, Object)
and returned from get(String)
, so modifications to these containers will flag the owner ParseObject
as dirty and these modifications persisted to Parse or LDS.
This is feature is bad for a number of reasons:
ParseObject
entry points which slows down execution time for simple things such as save()
, fetch()
, and even put(Sting, Object)
.Map
and List
and we auto-convert them to JSONObject
and JSONArray
when calling getJSONObject(String)
and getJSONArray(String)
. Since we need to keep track of mutable container changes, we have to internally call put(String, Object)
with the new JSONObject
or JSONArray
value so we can keep track of any changes to that object, however this comes with a side affect of making the object dirty and inability to receive updates to those values when using those methods. Removing this feature will allow us to update estimatedData
instead of using put(String, Object)
internally, which will fix this problem.Removing mutable containers would involve removing code related to tracking mutable containers as well as modifying put(String, Object)
and get(String)
to make a immutable copy of any container object passed in as the value or returned.
The reason for the proposal is that removing mutable containers would be a breaking change, but the assumption is that no one is relying on it on purpose. If a developer was relying on this "feature", only a small change would be required to re-enable the old behavior.
List<String> names = new ArrayList<>();
ParseObject object = new ParseObject("TestObject");
object.put("names", names);
object.save(); // Results in a creation of { "names": [] }
names.add("nikita");
object.save(); // Results in a update of { "names": ["nikita"] }
List<String> names = new ArrayList<>();
ParseObject object = new ParseObject("TestObject");
object.put("names", names);
object.save(); // Results in a creation of { "names": [] }
names.add("nikita");
object.save(); // Results in a no-op since the object isn't dirty
// To keep old functionality, call `put` after mutating the container to update
object.put("names", names);
object.save(); // Results in a update of { "names": ["nikita"] }
Feedback on this breaking change would be greatly appreciated!
When I am sending notification from Parse Push it send notification to some devices and for the rest it shows GCM- Mismatch sender id. I have configured Parse configuration properly in my app but sometime It store my app configured sender id generated GCM ID in it's device token field and then giving this GCM- Mismatch sender ID error. How to resolve this error?
ParseObjectCoder.encode
signature accepts ParseObject.State
, ParseOperationSet
and ParseEncoder
. While ParseObject.State
and ParseEncoder
is immutable and thread-safe, ParseOperationSet
can be mutated anytime and is not guarded by any mutex. We need to either guard the ParseOperationSet
with mutex or make a copy of this ParseOperationSet
somewhere and pass the copy to ParseObjectCoder.encode
.
When calling network requests, it seems that you don't terminate your InputStreams safely leading to resource leaking.
Android 5.1.0,
Genemotion emulator
parse-android:1.10.1.
Personally I would move to using something like OKHttp out of choice as it saves effort on these issues which have already been solved.
A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
java.lang.Throwable: Explicit termination method 'end' not called
at dalvik.system.CloseGuard.open(CloseGuard.java:184)
at java.util.zip.Inflater.<init>(Inflater.java:82)
at okio.GzipSource.<init>(GzipSource.java:62)
at com.squareup.okhttp.internal.http.HttpEngine.unzip(HttpEngine.java:650)
at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:832)
at com.squareup.okhttp.Call.getResponse(Call.java:274)
at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:230)
at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:201)
at com.squareup.okhttp.Call.execute(Call.java:81)
at com.parse.ParseOkHttpClient.executeInternal(ParseOkHttpClient.java:55)
at com.parse.ParseHttpClient$ParseNetworkInterceptorChain.proceed(ParseHttpClient.java:155)
at com.parse.ParsePlugins$1.intercept(ParsePlugins.java:111)
at com.parse.ParseHttpClient$ParseNetworkInterceptorChain.proceed(ParseHttpClient.java:144)
at com.parse.ParseHttpClient.execute(ParseHttpClient.java:119)
at com.parse.ParseRequest$3.then(ParseRequest.java:195)
at com.parse.ParseRequest$3.then(ParseRequest.java:192)
at bolts.Task$15.run(Task.java:825)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
at bolts.Task.completeAfterTask(Task.java:816)
at bolts.Task.continueWithTask(Task.java:628)
at bolts.Task.continueWithTask(Task.java:639)
at bolts.Task$13.then(Task.java:731)
at bolts.Task$13.then(Task.java:719)
at bolts.Task$15.run(Task.java:825)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Provide a Parse Android SDK integration with Stetho (http://facebook.github.io/stetho/) so developers can use the Chrome debugger to view REST API requests that Parse SDK is making to the backend. This requires implementing a network interceptor interface in Parse SDK. This will also make it easier for developers to differentiate between SDK client-side bugs and backend issues.
I am using Parse with the local datastore in my Android project, and I have met a problem when saving an object locally. The object saved on the server has pointers pointing to other objects. When I query the objects, the data is successfully retrieved. However, the pinInBackground() method seems not working after the query. The SaveCallback never gets called back.
Example Code:
ParseQuery<ParseObject> query = ParseQuery.getQuery("MyClass");
query.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> list, ParseException e) {
for (ParseObject object : list){
System.out.println("get object: " + object.getObjectId());
object.pinInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
if (e == null) {
System.out.println("pin successful");
} else {
System.out.println("pin error: " + e);
}
}
});
}
}
});
Is this a known issue? How should I go about debugging this or getting more diagnostic information?
It seems that ParseObject.pin() takes longer time with more objects saved in LocalDataStore
When LocalDataStore is empty, it takes only 500ms to pin 10 ParseObjects.
When there are 500 objects in LocalDataStore, it takes 2,000ms to pin.
When there are 1,000 objects in LocalDataStore, it takes 4,000ms to pin.
Of course we can avoid UI blocking by using pinInBackground, but meanwhile it seems that other pins and query processes are blocked, so when users transit to the next screen that uses ParseQueryAdapter right after pinInBackground, there's a black moment we can't show any data until pinInBackground is done.
I've attached a repro project file using Starter Project.
https://dl.dropboxusercontent.com/u/309225/ParseLocalDataStorePerformance.zip
By running it, you can see that pin is repeated, and its process time gets longer and longer.
Is there any way to make this faster?
Thanks for your advice.
Environment:
Galaxy Nexus Android 4.2.2
Parse SDK 1.10.1
For example in ParseUser
, ParseACL
, Parse
etc. A lot of the exceptions that are thrown (often as a result of JSONException
s) are RuntimeException
s. What's the reason for this? So you don't pollute everything with checked exceptions?
I can't seem to be able to find ParseQueryAdapter?
I've extended ParseQueryAdapter in our application with Parse SDK 1.9.4, but I can't seem to be able to find ParseQueryAdapter in 1.10.0.
I could not find it here in the github either. Is it removed/replaced or am I missing something?
I'm using Parse 1.10.1 and ParseFacebookUtils 1.10.1
When I try to link to facebook function, i got a problem.
Here is my simple code:
List<String> permissions = Arrays.asList("public_profile", "email", "user_birthday");
ParseFacebookUtils.linkWithReadPermissionsInBackground(ParseUser.getCurrentUser(), activity, permissions, new SaveCallback() {
@Override
public void done(ParseException e) {
if (ParseFacebookUtils.isLinked(user)) {
// linked success
} else if (e != null) {
// has error
if (e.getCode() == 208) {
MaterialDialogUtils.showOopsMaterialDialogs(activity, "Another user is already linked to this facebook ID. Please try another FB account.");
} else {
MaterialDialogUtils.showOopsMaterialDialogs(activity, "Can't link your account to FB. Code = " + e.getCode());
}
}
}
});
The problem is this function is alway successfull, when I link to a user has linked by another parseUser, It's return errorCode 208, but ParseFacebookUtils.isLinked(user) is true.
Is it a bug of ParseFacebookUtils?
Currently when uploading a file (i.e. image) to the server, all ParseFile constructors require taking a byte array. This requires me to read in the entire file into memory in order to send it.
Please provide a way for ParseFile to accept a stream (i.e., InputStream or StreamReader) and/or local file path so that the content of the file can be streamed to the server without reading the entire thing into memory.
I'd like to make parse class like below
class : group
field : objectId, member, name...
I assume that each member has own name of group int his device.
Therefore, they can make their customized name for the group
So i'm curious if It's possible to pin the specific field of ParseObject without saving to server when user request the function like saveInBackground
If it's possible, It would be very easy to develop this case.
Summary of the bug:
ParseException Code : 999
message: Linking to an external account not supported yet with signup_or_login. Use update instead.
Parse SDK version: 1.9.2
Facebook Android SDK version : 4.1.0
ParseFacebookUtils: V4-1.9.2
Steps to reproduce the bug:
https://github.com/alphanso/fb-bug-961932597190142
Steps :-
Previous bug report on facebook bug tool: https://developers.facebook.com/bugs/961932597190142
Hello,
I use GCM and i also want to use Parse SDK for devices that don't have Google Play Services.
For GCM implementation i declare these in AndroidManifest.xml
receiver -> com.google.android.gms.gcm.GcmReceiver
intent-filter -> com.google.android.c2dm.intent.RECEIVE
service -> com.woow.talk.managers.MyGcmListenerService
intent-filter -> com.google.android.c2dm.intent.RECEIVE
service -> com.woow.talk.managers.MyInstanceIDListenerService
intent-filter ->com.google.android.gms.iid.InstanceID
service -> com.woow.talk.managers.MyRegistrationIntentService
For Parse i've added this :
receiver ->com.woow.talk.managers.MyParsePushBroadcastReceiver
intent-filter -> com.parse.push.intent.RECEIVE
intent-filter -> com.parse.push.intent.OPEN
intent-filter -> com.parse.push.intent.DELETE
in application file i initialize the Parse SDK:
Parse.initialize(this, "xxx", "xxxx");
Parse.setLogLevel(Parse.LOG_LEVEL_VERBOSE);
ParseInstallation.getCurrentInstallation().saveInBackground();
Push from Parse comes but is received in GcmReceiver not in MyParsePushBroadcastReceiver. Can anybody explain me what am i doing wrong?
Adding MyParsePushBroadcastReceiver
public class MyParsePushBroadcastReceiver extends ParsePushBroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
super.onReceive(context, intent);
}
@Override
protected void onPushReceive(Context context, Intent intent) {
super.onPushReceive(context, intent);
}
@Override
protected Notification getNotification(Context context, Intent intent) {
return super.getNotification(context, intent);
}
}
Also i made some debug and the intent from parse comes with action com.google.android.c2dm.intent.RECEIVE and that is why is captured by com.google.android.gms.gcm.GcmReceiver.
Is this possible?
Thank you.
Will also need to keep reference to parent objectId
and className
, so we can recreate a pointer to parent if parent was GC'd.
I'm using a custom view adapter and not the parse query adapter. Is there any that I can load the next page of the database without using Parse query adapter?
I got error message Parse::UserCannotBeAlteredWithoutSessionError
Please tell me why?
if (ParseUser.getCurrentUser() != null) {
ParseUser currentUser = ParseUser.getCurrentUser();
if (edtEmail.getText().toString().length() > 0) {
currentUser.setEmail(edtEmail.getText().toString());
}
currentUser.setUsername(edtUsername.getText().toString());
currentUser.put(Constants.K_FE_PARSE_USER_BIO, edtBio.getText().toString().trim());
currentUser.put(Constants.K_FE_PARSE_USER_LOCATION, edtLocation.getText().toString().trim());
currentUser.put(Constants.K_FE_PARSE_USER_HEIGHT, sbHeight.getProgress());
if (edtPassword.getText().toString().length() > 1) {
currentUser.setPassword(edtPassword.getText().toString());
}
if (countryCode == null) {
countryCode = new CountryCodes().getCode(edtLocation.getText().toString());
}
currentUser.put(Constants.K_FE_PARSE_USER_COUNTRY_CODE, countryCode);
final MaterialDialog dialog = MaterialDialogUtils.createProgressDialog(activity);
dialog.show();
currentUser.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
dialog.dismiss();
if (e != null) {
ParseManager.getInstance().checkAndShowErrorMessage(activity, e);
} else {
if (isNeedToSendEmail) {
ParseUser currentUser = ParseUser.getCurrentUser();
if (currentUser != null) {
ParseManager.getInstance().sendVerifyEmailTo(activity, currentUser.getEmail(), currentUser.getObjectId(), currentUser.getString(Constants.K_FE_PARSE_USER_FIRST_NAME));
}
}
}
}
});
}
There is no query set for the parse push, but the error is given when pushed.
Parse version 1.9.1.
Expected: The object should be pushed to targeted channel without error.
Error encounter: Parse Can't set channels for a query-targeted push
Problem: There is clearly no query set for the push to target but the error was thrown.
ParsePush push = new ParsePush();
push.setChannel(AppConfig.PARSE_CHANNEL);
push.setData(JSONObject);
push.sendInBackground(new SendCallback() {
@Override
public void done(ParseException e) {
if(e==null) {
Toast.makeText(getApplicationContext(),"success",Toast.LENGTH_SHORT).show();
}
}
});
I read through the getting started tutorial and then the trouble shooting section to no avail.
Before I show you specifics, let me explain the issue.
Yesterday I tried to implement your push notification service but I could not receive any. So I kept trying and none were received. I tried scheduling and making them now but it didn't work. So I went to bed to try again tomorrow.
At 6 in the morning I was awoken to my phone buzzing. I looked at it and there were all the dozen notifications I had tried to send. Why did I receive them like 8 hours later? So later in the day I try to do it again and no luck. Until, sure enough, a few hours later when I was trying something else I received like a dozen push notifications (all of them the ones I had tried to send earlier) So right after this happened I tried sending another notification and bam. Right after I pushed the send button, I received it. Awesome! So I thought the problem had just fixed itself until I tried sending another push a little while ago and nothing happened. I've tried to send like 20 different pushes on different channels and nothing. (It should be noted that the night I first tried it I was on the default Broadcast channel and today I tried switching between that and a custom channel).
I have no idea what's wrong. I'm assuming it's either on my end or a possible bug in the SDK. So here is my code.
Here's my starting class
public class InitializeParse extends Application
{
public void onCreate()
{
super.onCreate();
Parse.enableLocalDatastore(getApplicationContext());
Parse.initialize(this, "PRIVATE_INFO", "PRIVATE_INFO");
ParseInstallation.getCurrentInstallation().saveInBackground();
ParsePush.subscribeInBackground("", new SaveCallback()
{
@Override
public void done(ParseException e)
{
if (e == null)
{
Toast.makeText(InitializeParse.this, "success!", Toast.LENGTH_LONG).show();
} else
{
Toast.makeText(InitializeParse.this, "not working", Toast.LENGTH_LONG).show();
}
}
});
}
}
It always toasts "success!"
Here's my manifest
<?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:protectionLevel="signature"
android:name="maxbleggi.afstudentplanner.permission.C2D_MESSAGE"/>
<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.EventListActivity"
android:label="@string/title_activity_event_list"
android:parentActivityName=".activities.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.MainActivity" />
</activity>
<activity
android:name=".activities.NoteListActivity"
android:label="@string/title_activity_note_list"
android:parentActivityName=".activities.EventListActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.EventListActivity" />
</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.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" />
<category android:name="maxbleggi.afstudentplanner" />
</intent-filter>
</receiver>
</application>
</manifest>
The parse notification dashboard always tells me they were sent successfully and there was 1 push sent (that is the current number of installations I have (me))
According to the parse tutorial and docs, everything should be going fine. I don't know what is causing this
I tried to do the following:
// Create Activity.
// this = ParseUser.getCurrentUser, auth-user.
// otherUser = non authenticated user.
SPActivity activity = SPActivity.create(SPActivity.class);
activity.setActivityType(SPActivity.ActivityType.FOLLOWING.getTypeId());
activity.setPerformedByUser(this);
activity.setRelatesToUser(otherUser);
activity.saveInBackground();
Internally parse is checking if all the childs of the object to save are updated and apparently the “fbProfile” field from non-auth otherUser (which contains the facebook data in a JSON object) always reports "hasChanges" so it tries to save the non-authenticated otherUser and it fails. I never changed otherUser data. Also I found this in stackoverflow:
"I was able to fix it by taking the user profile JSON object that you get from Facebook and saving each individual piece to Parse in a separate column in the user class, instead of saving the JSON object itself in a column. I don't know why this fixes it, but it seems, that having a JSON object causes a problem. Even leaving the code exactly the same and just deleting the JSON object from Parse allows the user to join the relation. Maybe it's a bug?"
What is the interceptor feature?
For the first time when a device is registered for push notification the _Installation class keeps a object containing the information of the device. However i deleted all the objects manually, and when i ran the registration API in android app, the object is not created. The problem exists on both AVD as well as hardware. However if I create a new AVD, which means a new piece with different ids, the object is then created.
The problem here is this is not possible with real users and hence upon deletion and re-registration a new object should be created.
Thanks in advance.
Looking forward for support
Why I cannot save jsonArray
in Parse Array type column?
Here is my code:
List<Image[]> images = photoAdapter.getListOfImages();
JSONArray jsonArray = new JSONArray();
for (Image[] i : images) {
JSONArray jsonArray1 = new JSONArray();
for (Image a : i) {
jsonArray1.put(a);
}
jsonArray.put(jsonArray1);
}
parseAd.put("images", jsonArray);
E java.lang.IllegalArgumentException: invalid type for ParseObject: class com.shoppingxxx.data.api.model.Image
E at com.parse.ParseEncoder.encode(ParseEncoder.java:149)
E at com.parse.ParseEncoder.encode(ParseEncoder.java:118)
E at com.parse.ParseEncoder.encode(ParseEncoder.java:118)
E at com.parse.ParseJSONCacheItem.<init>(ParseJSONCacheItem.java:21)
E at com.parse.ParseObject.addToHashedObjects(ParseObject.java:623)
E at com.parse.ParseObject.checkpointMutableContainer(ParseObject.java:1245)
E at com.parse.ParseObject.performOperation(ParseObject.java:2992)
E at com.parse.ParseObject.performPut(ParseObject.java:3026)
E at com.parse.ParseObject.put(ParseObject.java:3010)
Image
class:
public final class Image {
String field, value;
public String getField() {
return field;
}
public String getValue() {
return value;
}
}
Hello,
I have been having dificulties uploading my image file to parse.
I have been using the same code and it used to work. But for some unknown reason, it stops working.
Please refer to a question I made in stackoverflow to for more details and hopefully you can also give me an answer to solve this problem.
This is the link:
http://stackoverflow.com/questions/31993831/upload-imagefile-to-parse-is-broken
Hello, I want to use my own GCMSenderID.
When I register to Parse in my application OnCreate :
@OverRide
public void onCreate() {
super.onCreate();
...
Parse.initialize(this, getParseAppId(), getParseClientKey());
ParseInstallation.getCurrentInstallation().saveInBackground();
...
And in my Manifest :
...
;
...
When I launch my application I can see in Parse console a new row, with a strange deviceToken :
|ID|1|:ftMuTQhPEUI:<A_TOKEN_ID_INVALID_WITH_MY_GCM_SENDER_ID>
And an (undefined) GCMSenderId.
My app in Parse is well configured with GCM informations.
I try to link current ParseUser with facebook account. But it not work
List<String> permissions = Arrays.asList("public_profile", "email", "user_birthday");
ParseFacebookUtils.linkWithReadPermissionsInBackground(ParseUser.getCurrentUser(), activity, permissions, new SaveCallback() {
@Override
public void done(ParseException e) {
if (ParseFacebookUtils.isLinked(ParseUser.getCurrentUser())) {
// linked success
} else if (e != null) {
// has error
}
}
});
I waiting for 5 minute, and I don't get any response from this function.
And when facebook login dialog was show, if i press cancel icon, there are no response for this function (don't like login function, login function work well)
Please tell me, what wrong with this?
We have one table with four fields of the type pointer. They point to four different tables (including _User).
When Local Datastore is enabled running find on this Query results in:
com.parse.ParseException: java.lang.IllegalStateException: ParseObject has no data for this key. Call fetchIfNeeded() to get the data.
If we remove all pointers (set field to null) except the one to _User it works. We tried different scenarios with/without ACLs and CLPs on the table and on related tables. It's always the same. When we disable local datastore every tested scenario works.
iOS does not seem to have this problem.
We just need the pointer itself on the Android side (no includes), related objects are only used by Cloud Code.
The code where the error happens.
Parse.enableLocalDatastore(this);
Parse.initialize(this, PARSE_APPLICATION_ID, PARSE_CLIENT_KEY);
ParseQuery<MyClass> query = MyClass.getQuery();
query.findInBackground(new FindCallback<MyClass>(){
@Override
public void done(List<MyClass> list, ParseException e)
{
/* here we get the error */
}
});
When we remove the line Parse.enableLocalDataStore() everything works.
When calling the initialize
method, I would hope that any IO would be done off the UI thread.
Seen as the library is build on bolts, It would be safe assumption to make sure that any touching of resources should be handled by a task.
It would also be prudent to queue up subsequent tasks until the initialize
is fully completed.
5660-5660/com.owlr.tv.debug D/StrictMode﹕ StrictMode policy violation; ~duration=31 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=2591 violation=2
at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1137)
at libcore.io.BlockGuardOs.access(BlockGuardOs.java:67)
at java.io.File.doAccess(File.java:283)
at java.io.File.exists(File.java:363)
at android.app.ContextImpl.getDir(ContextImpl.java:2229)
at android.content.ContextWrapper.getDir(ContextWrapper.java:257)
at android.net.SSLSessionCache.<init>(SSLSessionCache.java:97)
at com.parse.ParseRequest.initialize(ParseRequest.java:137)
at com.parse.Parse.initialize(Parse.java:184)
at com.owlr.io.ParseAPIWrapper.init(ParseAPIWrapper.java:81)
The prior strict mode violation occurs when calling:
Parse.enableLocalDatastore(application);
Parse.initialize(application, metaDataManager.getParseAppId(),
metaDataManager.getParseClientKey());
Either that or its made a bit clearer that IO operations happen on initialize
.
After calling ParseQuery.findInBackground a couple of times the callback is not called anymore.
Looking at the code it seems that the continuation on ParseTaskUtils.callbackOnMainThreadAsync is never called.
Sample project that reproduces the problem: https://www.dropbox.com/s/gfc3bququt9pn3k/Parse-Starter-Project-1-3.zip?dl=0
Steps to reproduce the bug:
1.- In the first Activity tap on the text.
2.- Search for a user.
3.- Tap on the user result.
4.- Go back to search.
5.- Search for a user.
6.- Notice there are no more results because done() in SPUser.usersForSearchTerm is never invoked.
7.- Also notice there is a deadlock when the user taps on any image in the profile. It is usually when calling ParseObject.getObjectId() or ParseObject.getString(). Maybe it is related.
ParseQuery.fromNetwork()
would be useful for toggling a query .fromLocalDatastore()
<-> .fromNetwork()
to mimic CACHE_THEN_NETWORK
and CACHE_ELSE_NETWORK
from query caching.
We already have the private API, so it'd be super easy to enable this.
We'd also need to remove the limitation of mutating an inflight query, which should be fine since we now since ParseQuery.State
is passed to the controller as an immutable object.
Why the design choice to keep all classes in the same package?
Is there any list of features that needs to be implemented so we can help building those ?
I need to implement filterable on ParseQueryAdapter but the list of objects is a private field. I'd be happy to implement a solution for this and contribute to the Parse Android SDK but I couldn't find the ParseQueryAdapter class here. Is it open source?
First, thank you for open sourcing the SDK!
This is a question rather than an issue. Are you planning to open source other parts of the SDK such us ParseFacebookUtils and ParseTwitterUtils? So we could include the whole SDK from the gradle rather than copying distinct jar files.
Can anyone tell me how to upload files to the user class if i make a file column in the User class? The conventional way of uploading files asks to upload the file first in a class and to put a column name where the file has to be saved. The file gets saved correctly in every other class except the _User class. This is my code to upload the file.
ParseFile file = new ParseFile("newfile.png", image);
// Upload the image into Parse Cloud
file.saveInBackground();
Parse Object imgupload = new ParseObject("pic");
imgupload.put("ProPicture", file);
imgupload.saveInBackground();
//this works fine but if i change the name of the class from "pic" to "_User", the log cat displays that I //should use parse.create() method for this or use a proper sublcass. So i tried using that method and here is my code
ParseObject imgupload= ParseObject.create("_User");
imgupload.put("username","hello");
imgupload.put("password","hello");
imgupload.put("ProPicture", file);
imgupload.saveInBackground();
//nothing happens by this code so i replaced .saveInBackground() by just save(); and still the log cat gave me an error saying that " Cannot save a ParseUser until it has been signed up. Call signUp first."
ParseObject doesn't have any signUpIn() method and I don't know how to convert ParseObject into ParseUser.. Can someone help me with this? I just want to upload a profile pic while signing up the user.
Affected: All android parse users, maybe more
Problem:
When I created an account when I first opened the app, I captured the HTTP request it sent, than I replayed the request and edited the 'satoshi' part to however many satoshis I would want, changed the username so it would register
{"password":"passwordsarefun","device_id":"1111111 1111111111","tampered":false,"totalSatoshi":0,"use rname":"SoAreUsernames","satoshi":9999999999999999 ,"emailAddress0":"[email protected]","dailyReward ":0}
Than all you have to do is login and withdraw
Proposed solution:
A solution would be to use an encryption method. I assume your sdk is already encrypted and obfuscated. Simply have the sdk make a call to the server with AES encrypted strings. Parse should have a master key only known to them that can then decrypt the data and use it accordingly IE make a new user, or update user object. So there is your solution. You can ofcourse have the master key be different for each unique user and app, and have it reset randomly so no one can begin to try and decipher it. However that would require much more code.
issue has been brought up to no avail here https://groups.google.com/forum/#!topic/parse-developers/3jYTao2C4PY
Trying to make a ParseQuery.findInBackground never receives the callback ParseUser.done().
Steps to reproduce the bug:
1.- Call ParseQuery.findInBackground after it has been called in different places.
2.- Notice done callback stops being invoked.
For further details, please refer to this bug:
https://developers.facebook.com/bugs/451257781712794/?search_id
After looking through the source code, I see that you are not using the registration method provided by the GoogleCloudMessaging class, and are instead sending an intent manually.
I did a bit of digging, and the registration intent that you send seems to be similar to what the register method does.
Have you seen better results registering via this manual intent, versus calling the above method? I am very curious to this because my personal apps, have had some very severe issues with GCM, and it's reliability.
private void send() {
Intent intent = new Intent(REGISTER_ACTION);
intent.setPackage("com.google.android.gsf");
intent.putExtra("sender", senderId);
intent.putExtra("app", appIntent);
ComponentName name = null;
try {
name = context.startService(intent);
} catch (SecurityException exception) {
// do nothing
}
if (name == null) {
finish(null, "GSF_PACKAGE_NOT_AVAILABLE");
}
tries.incrementAndGet();
PLog.v(TAG, "Sending GCM registration intent");
}
I've tested if saveEventually function is called when network state is changed from unavailable to available.
Sometimes, saveEventually is called just after that time but sometimes it's not called for a long time (I waited for 10 minutes but it was not called. when i re-changed my network state, it was called...)
I think saveEventually occasionally does not recognize the change of network state.
Is there any bug??? and solution?
I noticed that I can't get deviceToken with Android 6 (emulator). I tried also with Android 5 emulator and it works. Can't test with the real device yet because I don't have compatible device.
Is Android Parse SDK prepared also for these changes:
*In Android 6 SDK app has to request permissions in runtime.
*In Android 6 SDK device goes to Doze mode which means that "Network access is disabled, unless your app receives a high-priority Google Cloud Messaging".
When my users updates the app I call ParseInstallation.getCurrentInstallation().saveInBackground but the SDK won't trigger a call to the server, this causes the appVersion fields in the Installation table to be incorrect
By overviewing the code (thanks for open-sourcing) it seems to be by design (Nothing has really changed in the Installation so updateBeforeSave doesn't trigger.
Please explain this
As far as I searched ParseQueryAdapter is only compatible with Listview, but there is no official way to use it with RecyclerView. Will there be a tutorial or a new adapter that will be compatible with recycler view??
Hello I just installed the tutorial on a device and tested the pushes. If we use GCM is working fine all pushes being delivered. Once we remove the GCM from android manifest we can see in logs that the app is using the ppns but seems the ppns service is reconnecting in loop.
08-26 16:20:25.175 21482-21482/com.parse.starter V/com.parse.ManifestInfo﹕ Using ppns for push.
08-26 16:20:25.225 21482-21534/com.parse.starter V/com.parse.CachedCurrentInstallationController﹕ Successfully deserialized Installation object
08-26 16:20:25.235 21482-21482/com.parse.starter D/StarterApplication﹕ 5d0c6c16-5c45-43a5-b347-1fff6ae9a69a
08-26 16:20:25.235 21482-21482/com.parse.starter W/ApplicationPackageManager﹕ getCSCPackageItemText()
08-26 16:20:25.245 21482-21482/com.parse.starter I/PersonaManager﹕ getPersonaService() name persona_policy
08-26 16:20:25.285 21482-21482/com.parse.starter I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.internal.widget.TintTypedArray.getChangingConfigurations
08-26 16:20:25.285 21482-21482/com.parse.starter W/dalvikvm﹕ VFY: unable to resolve virtual method 449: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
08-26 16:20:25.285 21482-21482/com.parse.starter D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
08-26 16:20:25.285 21482-21482/com.parse.starter I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.internal.widget.TintTypedArray.getType
08-26 16:20:25.285 21482-21482/com.parse.starter W/dalvikvm﹕ VFY: unable to resolve virtual method 471: Landroid/content/res/TypedArray;.getType (I)I
08-26 16:20:25.285 21482-21482/com.parse.starter D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
08-26 16:20:25.345 21482-21482/com.parse.starter V/PPNSService﹕ Received request to start service if required
08-26 16:20:25.345 21482-21482/com.parse.starter D/StarterApplication﹕ sbscribed to aila
08-26 16:20:25.345 21482-21482/com.parse.starter I/StarterApplication﹕ Installation saved successfully
08-26 16:20:25.345 21482-21546/com.parse.starter V/com.parse.PushConnection﹕ PushConnection transitioning from com.parse.PushConnection$WaitStartState@42b41aa0 to com.parse.PushConnection$ConnectState@42b4b260
08-26 16:20:25.376 21482-21482/com.parse.starter I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:381>: EGL 1.4 QUALCOMM build: (CL3869936)
OpenGL ES Shader Compiler Version: 17.01.11.SPL
Build Date: 01/17/14 Fri
Local Branch:
Remote Branch:
Local Patches:
Reconstruct Branch:
08-26 16:20:25.426 21482-21482/com.parse.starter D/OpenGLRenderer﹕ Enabling debug mode 0
08-26 16:20:26.066 21482-21546/com.parse.starter V/com.parse.PushConnection﹕ PushConnection transitioning from com.parse.PushConnection$ConnectState@42b4b260 to com.parse.PushConnection$ConnectedState@42c41b30
08-26 16:20:26.226 21482-21546/com.parse.starter V/com.parse.PushConnection﹕ PushConnection transitioning from com.parse.PushConnection$ConnectedState@42c41b30 to com.parse.PushConnection$WaitRetryState@42c68230
08-26 16:20:26.226 21482-21546/com.parse.starter V/com.parse.PushConnection﹕ PushConnection transitioning from com.parse.PushConnection$WaitRetryState@42c68230 to com.parse.PushConnection$ConnectState@42c68e50
08-26 16:20:27.037 21482-21546/com.parse.starter V/com.parse.PushConnection﹕ PushConnection transitioning from com.parse.PushConnection$ConnectState@42c68e50 to com.parse.PushConnection$ConnectedState@42cd1070
08-26 16:20:27.247 21482-21546/com.parse.starter V/com.parse.PushConnection﹕ PushConnection transitioning from com.parse.PushConnection$ConnectedState@42cd1070 to com.parse.PushConnection$WaitRetryState@42ce6eb8
08-26 16:20:27.247 21482-21546/com.parse.starter V/com.parse.PushConnection﹕ PushConnection transitioning from com.parse.PushConnection$WaitRetryState@42ce6eb8 to com.parse.PushConnection$ConnectState@42ce79e8
08-26 16:20:28.168 21482-21546/com.parse.starter V/com.parse.PushConnection﹕ PushConnection transitioning from com.parse.PushConnection$ConnectState@42ce79e8 to com.parse.PushConnection$ConnectedState@42d4d068
08-26 16:20:28.348 21482-21546/com.parse.starter V/com.parse.PushConnection﹕ PushConnection transitioning from com.parse.PushConnection$ConnectedState@42d4d068 to com.parse.PushConnection$WaitRetryState@42d6a010
08-26 16:20:28.348 21482-21546/com.parse.starter V/com.parse.PushConnection﹕ PushConnection transitioning from com.parse.PushConnection$WaitRetryState@42d6a010 to com.parse.PushConnection$ConnectState@42d6ab40
08-26 16:20:29.830 21482-21546/com.parse.starter V/com.parse.PushConnection﹕ PushConnection transitioning from com.parse.PushConnection$ConnectState@42d6ab40 to com.parse.PushConnection$ConnectedState@42de59d8
Looking into the PushConnection source code (over the sources resulted from AndroidStudio decompiler)
Seems in this method readLine is always null. I guess the server close the connection and the client tries to reconnect.
private void runReaderLoop(BufferedReader reader) {
while(true) {
String line = null;
try {
line = reader.readLine();
PushConnection.this.lastReadTime.set(SystemClock.elapsedRealtime());
} catch (IOException var9) {
;
}
......
Any idea on how can I debug on what's going wrong ? I tried several devices all behaves in the same way.
Silviu
Add an automatic local/language detection and store it in ParseInstallation
for further processing and smarter query. The local/language will be stored under localeIdentifier
inside ParseInstallation
Initialize like this:
Parse.initialize(context, parseApplicationId, parseClientKey);
ParseInstallation.getCurrentInstallation().saveInBackground();
I´m getting the device token like this:
String deviceToken = (String) ParseInstallation.getCurrentInstallation().get("deviceToken");
D/com.parse.GcmRegistrar﹕ Got error when trying to register for GCM push
java.lang.Exception: GCM registration error: SERVICE_NOT_AVAILABLE
at com.parse.GcmRegistrar$Request.finish(GcmRegistrar.java:387)
at com.parse.GcmRegistrar$Request.onReceiveResponseIntent(GcmRegistrar.java:377)
at com.parse.GcmRegistrar.handleRegistrationIntentAsync(GcmRegistrar.java:205)
at com.parse.GCMService.handleGcmRegistrationIntent(GCMService.java:97)
at com.parse.GCMService.onHandleIntent(GCMService.java:83)
at com.parse.GCMService.access$000(GCMService.java:29)
at com.parse.GCMService$1.run(GCMService.java:63)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
What may be happening? it was working before but just and 1.10.1
didn´t fix it.
Occasionally it is very slow to query from pinned data
I've been told that using "fromPin" instead of "fromLocalDataStore" could have performance improvement.
However, it was very fast(0.2sec) sometimes but it was so slow(2~3sec) sometimes....
I didn't add any "where clause" like whereEqualTo, i just tried find().
Please, let me know the reason and how to solve this problem
Hi, Just started to try out Parse for Android.
I tryed to build a demo-project with ProGuard enabled. When I do that I get the following Exception:
:app:proguardRelease
Warning:com.parse.ParseOkHttpClient$CountingOkHttpRequestBody: can't find superclass or interface com.squareup.okhttp.RequestBody
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.OkHttpClient
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Call
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Response
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.ResponseBody
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Response
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Headers
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Response
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.ResponseBody
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.MediaType
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Request$Builder
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Headers$Builder
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Request$Builder
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Response
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.ResponseBody
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Request$Builder
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Headers$Builder
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Headers
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Call
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.ResponseBody
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Headers
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.MediaType
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Request
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.OkHttpClient
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Request
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Call
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Response
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.ResponseBody
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Request
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Request$Builder
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Headers$Builder
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Headers
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Request
Warning:com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Response
Warning:com.parse.ParseOkHttpClient$CountingOkHttpRequestBody: can't find referenced class com.squareup.okhttp.RequestBody
Warning:com.parse.ParseOkHttpClient$CountingOkHttpRequestBody: can't find referenced class com.squareup.okhttp.MediaType
Warning:com.parse.ParseOkHttpClient$CountingOkHttpRequestBody: can't find referenced class okio.BufferedSink
Warning:com.parse.ParseOkHttpClient$CountingOkHttpRequestBody: can't find referenced class com.squareup.okhttp.RequestBody
Warning:com.parse.ParseOkHttpClient$CountingOkHttpRequestBody: can't find referenced class com.squareup.okhttp.MediaType
Warning:com.parse.ParseOkHttpClient$CountingOkHttpRequestBody: can't find referenced class okio.BufferedSink
Warning:com.parse.ParseOkHttpClient$CountingOkHttpRequestBody: can't find referenced class com.squareup.okhttp.MediaType
Warning:com.parse.ParseOkHttpClient$CountingOkHttpRequestBody: can't find referenced class okio.BufferedSink
Warning:there were 66 unresolved references to classes or interfaces.
I tryed the Solution from this StackOverflow Question: http://stackoverflow.com/questions/30680868/android-using-parse-com-missing-classes-on-proguard
That reduces the amount of Exceptions:
:app:proguardRelease
Warning:com.parse.ParseOkHttpClient$CountingOkHttpRequestBody: can't find referenced class okio.BufferedSink
Warning:there were 4 unresolved references to classes or interfaces.
if object A is connected to object B using array and object B is connected to object C using array and object C is connected to object A using array pinning of any of this objects is infinite according to recursion.
Test case;
public void testPinning(){
ParseObject user1 = ParseObject.createWithoutData(ParseUser.class,"1");
ParseObject user2 = ParseObject.createWithoutData(ParseUser.class,"2");
ParseObject user3 = ParseObject.createWithoutData(ParseUser.class,"3");
user1.add("follower",user2);
user2.add("follower", user3);
user3.add("follower", user1);
List<ParseObject> users = new ArrayList<>();
users.add(user1);
users.add(user2);
users.add(user3);
try {
ParseObject.pinAll(users);
} catch (ParseException e) {
e.printStackTrace();
Assert.assertTrue(false);
}
Assert.assertTrue(true);
}
Hello
I have found a vital problem using parse in unity engine. we have developed a game using unity which works perfectly fine without using parse. The problem is that when we attach the parse to our game, in the first opening of the game application on ANDROID - IF YOU CLICK IN A FEW SECOND RIGHT AFTER INSTALLATION- a force close happens. After some deliberation, I came to know that the problem happens right at the initialization of the parse due to some code related to " Receiver Functions" in manifest.
receiver android:name="com.parse.ParsePushBroadcastReceiver"
When I remove this part of the code the application works fine ; But , when existing, There is a problem if you click on open in a few minutes right at the beginning of the installation.
I'd be so appreciated if you could answer me as soon as possible since the game's release date is about to arrive.
Thank you so much for your attention
Frequency: 100%
Environment:
Android 4.1.1
Parse SDK 1.10.0
When setting query's include() to a certain condition, ParseObject.saveAll() fails, and the query doesn't function properly after restarting the app.
Below is the repro code with Parse Starter Project.
https://dl.dropboxusercontent.com/u/309225/androidIssue14.zip
I commented out the lines causing the problem, so when running it straight, a Feed object is created to Parse, then a query fetches it with 1 result, flag it as "read" and save to Parse. Then the same should happen when running it again. This is the expected behavior.
Then, when uncommenting the line 94 in MainActivity.java and running, an error "object not found for update" occurs upon saving the "read" flag to Parse.
Then, when running it again, very weirdly, the query's results becomes 0.
This doesn't change after re-running repeatedly, but when deleting the app and running it again, the same error code happens with 1 result.
The server side is clean, haven't set up CloudCode nor any Class Level Permissions.
I've reported before a problem with pin ( https://developers.facebook.com/bugs/901559459903544/ ), and I thought I could go forward now that it's finally fixed, but now stopped by this error.
Thanks in advance for your advice.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.