小编VyT*_*cdc的帖子

从JSON包中检索信息

在收到通知时,我收到了下面提到的一些数据

Bundle[{google.sent_time=1233212221545, msg={"message":"You received a chat message","type":"Match Maker","request_id":"501"}, chat={"owner":0,"request_id":"501"}, from=148566781839, google.message_id=0:148354545211779676%c3fc9c6ff9fd7ecd, android.support.content.wakelockid=3, collapse_key=do_not_collapse}]
Run Code Online (Sandbox Code Playgroud)

从此我想要检索

  1. message
  2. Request_id
  3. Owner
  4. type

我试图像这样检索

String mes1 = extras.getString("chat");
Run Code Online (Sandbox Code Playgroud)

我得到了这些价值观

{"owner":0,"request_id":"501"}
Run Code Online (Sandbox Code Playgroud)

示例:从上面我想获取所有者和请求ID如何检索这些值.

这是我的代码:

public class GCMIntentService extends IntentService {
    public static final int NOTIFICATION_ID = 1;
    private static final String TAG = "GcmIntentService";
    UserLocalStore userLocalStore;
    private NotificationManager mNotificationManager;

    public GCMIntentService() {
        super("GcmIntentService");
    }

    Intent notificationIntent;
    String type,token,requestid,notify_message;
    Context context;

    @Override
    protected void onHandleIntent(Intent intent) {

        userLocalStore = new UserLocalStore(this);
        Bundle extras = intent.getExtras();

        GoogleCloudMessaging gcm = …
Run Code Online (Sandbox Code Playgroud)

android android-json

7
推荐指数
1
解决办法
1058
查看次数

javascript with firebase Push方法在聊天页面中显示两次或多次值.每当我回到页面并来聊天页面

我正在使用firebase创建一个简单的聊天页面每当我从当前页面(聊天页面)返回页面并回到聊天页面并发送消息"嗨"时它会在聊天页面中显示两次,如果我返回到另一个页面页面再次回到聊天页面并发送消息,它显示3次相同,反之亦然,它显示多次.

吼叫是我的编码.请一些人指导我..

$(document).on('pagebeforeshow', '#chatpage', function() {

    var ref = new Firebase("https://firechatweb-60edc.firebaseio.com/6pzzmujf");
    $("#images6").empty();
    ActivityIndicator.show();
    ref.orderByChild("messages").on("child_added", function(snapshot) {

        $("#images6").append(movielist(snapshot.val()));

        var last_li = $("ul li:last-child").offset().top;

        //alert(last_li);
        setTimeout(function() {
            $.mobile.silentScroll(last_li);
        }, 50);

        //console.log(JSON.stringify(snapshot.key()) + " was " +JSON.stringify(snapshot.val()));
        ActivityIndicator.hide();




    });


});




function movielist(item) {
    //return "<li style='height:43px; border-bottom: 1px solid grey; font-size:15px; margin-top:18px;' ><a href='#' style='text-decoration:none;' data-name="+item.text+"><span class='left'>"+item.text+"</span><div class='clear'></div></a></li>";
    return "<li style='font-size:15px; margin-top:18px;' margin-left:10px;><a href='#' style='text-decoration:none;' data-name=" + item.text + "><span class='left'>" + item.text + "</span><div class='clear'></div></a></li>";
}


$("#button").click(function() {


    //alert("Hi");
    var u = …
Run Code Online (Sandbox Code Playgroud)

javascript jquery cordova firebase firebase-realtime-database

3
推荐指数
1
解决办法
303
查看次数

核心数据删除不起作用

嗨,我正在尝试删除我在波纹管编码中保存的核心数据值,但它显示已删除,当我再次运行该项目时,它显示包括已删除的值意味着它没有从核心数据中删除

谁可以帮我这个事...

    - (IBAction)Delete:(id)sender
    {

        AppDelegate * appdel = (AppDelegate *)[[UIApplication sharedApplication]delegate];
        NSString *soughtPid= self.text1.text;

        NSEntityDescription * productEntity = [NSEntityDescription entityForName:@"Students" inManagedObjectContext:appdel.managedObjectContext];
        NSFetchRequest *fetch=[[NSFetchRequest alloc] init];
        [fetch setEntity:productEntity];
        NSPredicate *p=[NSPredicate predicateWithFormat:@"name == %@", soughtPid];
        [fetch setPredicate:p];
        //... add sorts if you want them
        NSError *fetchError;
        NSArray *fetchedProducts=[appdel.managedObjectContext executeFetchRequest:fetch error:&fetchError];
        // handle error
        for (NSManagedObject *product in fetchedProducts) {
            [appdel.managedObjectContext deleteObject:product];



            NSLog(@"Deleted Names : %@",[product valueForKey:@"name"]);
            NSLog(@"****.......*****");
        }
         [tableview reloadData];
    }

Core Data Available values are 4 mentioned bellow.

2015-10-24 16:47:23.588 …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios ios5 ios7

2
推荐指数
1
解决办法
906
查看次数