小编Jat*_*tel的帖子

从FCM onMessageReceived方法获取RemoteMessage的值

我有迁移gcm to fcm推送通知消息.但我如何从RemoteMessage获取捆绑数据收到onMesssageReceived方法.

Old GCM give bundle data onMessageReceiced method but in FCM there is RemoteMessage data.
Run Code Online (Sandbox Code Playgroud)

所以请告诉我如何解析remotemessage获取所有通知值.

我的PAYROL

{
"collapse_key":"score_update",
"priority":"high",
"content_available":true,
"time_to_live":108,
"delay_while_idle":true,
"data": 
{ 
    "message": "Message for new task",
    "time": "6/27/2016 5:24:28 PM"
},
"notification": {
    "sound": "simpleSound.wav",
    "badge": "6",
    "title": "Test app",
    "icon": "myicon",
    "body": "hello 6 app",
    "notification_id" : "1140",
    "notification_type" : 1,
    "notification_message" : "TEST MESSAGE",
    "notification_title" : "APP"
  },
"registration_ids": ["cRz9SJ-gGuo:APA91bFJPX7_d07AR7zY6m9khQro81GmSX-7iXPUaHqqcOT0xNTVsOZ4M1aPtoVloLNq71-aWrMCpIDmX4NhMeDIc08txi6Vc1mht56MItuVDdA4VWrnN2iDwCE8k69-V8eUVeK5ISer"
]
}
Run Code Online (Sandbox Code Playgroud)

java android android-notifications google-cloud-messaging firebase-cloud-messaging

22
推荐指数
2
解决办法
4万
查看次数

如何在android中创建模态对话框

我想为我的应用程序创建模态对话框.

所以当模态对话框打开时,其他活动被阻止.没有像后退按钮或按下主页按钮那样的事件.

并在该对话框取消和确定两个选项按钮.

谢谢...

android modal-dialog android-ui

15
推荐指数
4
解决办法
5万
查看次数

有没有办法动态更改应用内购买的价格?

我的应用程序具有应用程序内购买功能,并且需要动态更改应用程序内购买的价格。

那么有什么办法可以做到这一点吗?

android in-app-purchase

6
推荐指数
1
解决办法
2010
查看次数

使用gps数据使用纬度和经度计算距离.

我正在尝试使用gps lat和long数据计算距离.

但是我无法得到准确的结果.当我得到静态数据时,距离公式工作完美,

public class NWDService extends Service implements LocationListener {


    private LocationManager myLocationManager;
    private LocationProvider myLocationProvider;

    NotificationManager myNotificationManager;
    private long frequency;

    private Handler handler;
    private double total_distance = 0;
    private Location currentLocation;
    public void onLocationChanged(Location newLocation) {
        try {
            System.out.println("latitude current :"+currentLocation.getLatitude());
            System.out.println("latitude current :"+currentLocation.getLongitude());
            System.out.println("latitude new  :"+newLocation.getLatitude());
            System.out.println("latitude new  :"+newLocation.getLongitude());
            System.out.println("distance total :"+total_distance);
            //System.out.println(distance(22.306813, 73.180239,22.301016, 73.177986, 'K') + " Kilometers\n");
            double diff = 0.0;
            diff = currentLocation.getLatitude()- newLocation.getLatitude();
            System.out.println("difference ::"+diff);
            if(diff != 0){

                total_distance = total_distance + distance(currentLocation.getLatitude(), …
Run Code Online (Sandbox Code Playgroud)

android

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

如何在后台控制FCM消息通知

我已在我的应用程序中实施了FCM Firebase云消息传递.当应用程序处于forground模式时,我收到通知及其数据.

问题:

当我的应用程序处于后台模式或当时被杀死时,通知会通过FCM自动生成.所以我无法控制到达的通知数据(通知的coustom数据字段).当应用程序处于后台模式并且通知到达时,MyFirebaseMessagingService类的onMessageReceived(RemoteMessage remoteMessage)方法不会调用.

请帮助在两种模式下获得通知控制(与GCM相同)

java android android-notifications firebase-cloud-messaging

0
推荐指数
1
解决办法
992
查看次数